Sau đây mình xin hướng dẫn cách đơn giản nhất để Thêm đuôi .html vào link sản phẩm woocommerce WordPress.

Cách Thêm đuôi .html vào link sản phẩm woocommerce WordPress
Hãy chèn đoạn code dưới dây vào file functions.php trong theme wordpress bán hàng . Sau khi thêm xong hãy vào bên trong admin cấu hình lại đường dẫn và nhớ bấm Lưu thiết lập
/** Customize link woo anbiweb*/ add_action('init', 'it60s_change_page_permalink', -1); function it60s_change_page_permalink() { global $wp_rewrite; if ( strstr($wp_rewrite->get_page_permastruct(), '.html') != '.html' ) $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html'; } add_action( 'rewrite_rules_array', 'rewrite_rules' ); function rewrite_rules( $rules ) { $new_rules = array(); foreach ( get_post_types() as $t ) $new_rules[ $t . '/([^/]+).html$' ] = 'index.php?post_type=' . $t . '&name=$matches[1]'; return $new_rules + $rules; } add_filter( 'post_type_link', 'custom_post_permalink' ); // for cpt post_type_link (rather than post_link) function custom_post_permalink ( $post_link ) { global $post; $type = get_post_type( $post->ID ); return home_url( $type . '/' . $post->post_name . '.html' ); }

Xem thêm :
- Full code theme wordpress Hoàng hà Mobile
- Full theme code wordpress cho dân viết Blog
- Share theme JNews 7.1.0 – WordPress theme mới nhất update 31/08/2020