add_filter('post_type_link', 'wpse33551_post_type_link', 1, 3);
function wpse33551_post_type_link( $link, $post = 0 ){
if ( $post->post_type == 'product' ){
return home_url( 'product/' . $post->ID );
} else {
return $link;
}
}
add_action( 'init', 'wpse33551_rewrites_init' );
function wpse33551_rewrites_init(){
add_rewrite_rule(
'product/([0-9]+)?$',
'index.php?post_type=product&p=$matches[1]',
'top' );
}
wordpress
http://wordpress.stackexchange.com/questions/33551/how-to-rewrite-uri-of-custom-post-type/33555#33555
<iframe width="100%" height="506" src="http://snipet.teknotit.com/index.php?embed=546e3aee35a62" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 20/11/2014