Chào các bạn. hôm nay mình sẽ gửi các bạn một đoạn code xóa đi slug /san-pham/ hoặc /product/ khi các bạn dùng plugin Woocommerce

Các bạn add đoạn sau vào file function.php của theme nha. À code dưới còn thêm html vào phía sau đường dẫn để thân thiện với SEO

function wpse_178112_permastruct_html( $post_type, $args ) {
    if ( $post_type === 'product' )
        add_permastruct( $post_type, "{$args->rewrite['']}/%$post_type%.html", $args->rewrite );
}

add_action( 'registered_post_type', 'wpse_178112_permastruct_html', 10, 2 );
0 CommentsClose Comments

Leave a comment