I used in post type slug 'game/%games%' and in taxonomy slug 'game'
And it solved the problem.
Make sure you have a slug in your taxonomy.
Domanda
I'm having a hard time setuping my WP.
My structure peramink is this one :
game/taxonomy-slug/postname
To do so, i use the plugin UltimateCMS.
I've made my custom post type name "game" who's configured like this:
rewrite : true, slug : game/%games%, width tront : true, feed : true, page : true, hierarchical : false
And my taxonomy is named "games" and is configured like this:
hierarchical : false, rewrite : true, slug : %games%, width tront : false
Oh and I also use this in my function file :
add_filter('post_link', 'rating_permalink', 10, 3);
add_filter('post_type_link', 'rating_permalink', 10, 3);
function rating_permalink($permalink, $post_id, $leavename) {
if (strpos($permalink, '%games%') === FALSE) return $permalink;
// Get post
$post = get_post($post_id);
if (!$post) return $permalink;
// Get taxonomy terms
$terms = wp_get_object_terms($post->ID, 'games');
if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
else $taxonomy_slug = 'autres';
return str_replace('%games%', $taxonomy_slug, $permalink);
}
I currently have the URLs that i want whith this but the thing is that this taxonomy break my statics pages. I have a page (url: /web-tv/) that does not work anymore. If I desactivate my "games" taxonomy it does work again.
The weird thing is that my /web-tv/ page can work if I make its URL go on a 3rd level like this : /info/toto/web-tv/
I tried everything in my skills but i can't find any solution.
Any ideas ?
Thanks a lot !!!
Soluzione
I used in post type slug 'game/%games%' and in taxonomy slug 'game'
And it solved the problem.
Make sure you have a slug in your taxonomy.