Teknotit Snipet Manager



Api 2 Git 1 aleatoire 2 animation 1 apache2 4 bash 9 cache 1 css 17 curl 1 fastcgi 2 fichier 1 fonctions 10 html 5 inspiration 1 javascript 17 linux 17 mobile 2 mysql 2 nginx 3 php 21 postfix 2 repertoire 3 ssh 9 swap 1 sysadmin 13 taille 1 ubuntu 7 wordpress 8

.

How to rewrite URI of custom post type

How to rewrite URI of custom post type

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

Flux RSS de cette page


Teknotit Snipet Manager 1.84 par Bronco - Page générée en 0.004 s