سلام
function product_post_type_link( $link, $post = 0 ){
if ( $post->post_type == 'product' ){
return home_url( 'product/' . $post->ID );
} else {
return $link;
}
}
add_filter( 'post_type_link', 'product_post_type_link', 1, 3 );
function product_rewrites_init(){
add_rewrite_rule(
'product/([0-9]+)?$',
'index.php?post_type=product&p=$matches[1]',
'top' );
}
add_action( 'init', 'product_rewrites_init' );
در فایل functions.php قالبتون قرار بدید