I'm using the plugin "types" to register the custom taxonomy and post types,
and got 404 when using the same slug for them to display them hierarchy, like this:
site.com/tax //taxonomy archive
site.com/tax/post-type //entry
how to make this url structure work ?
Thanks
Dear Mido,
I couldn't get it to work with site.com/tax/post-type, but it does work with site.com/post-type/tax like this:
In your custom type, use a custom URL format in the Rewrite option. Like this:
Then add these lines in functions.php of your theme, to replace %tax% with its proper value:
add_filter('post_type_link', 'my_permalink_structure', 10, 4);
function my_permalink_structure($post_link, $post, $leavename, $sample) {
if ( false !== strpos( $post_link, '%tax%' ) ) {
$term = get_the_terms( $post->ID, 'tax' );
$post_link = str_replace( '%tax%', array_pop($term)->slug, $post_link );
}
return $post_link;
}
Please let me know if there is anything else that I can assist you with.
Regards.
Caridad
It doesn't work. I created a page called TESTER and it gave me this permalink .com/organizer//tester along with the error listed below. The error displayed white editing the post, just under the the edit permalink option.
Warning: array_pop() [function.array-pop]: The argument should be an array in /home/content/33/8824133/html/wp-content/themes/education/functions.php on line 106
When I go to edit the Taxonomy, I see this option (Use a custom URL format). What can I use here that actually works? Seems like nothing does.
Pardon my frustrations but its SO hard to make categories or tax show up in the url. Again, I'm not mad but it seems like everyone at WP-Types is clueless when it comes to this. I want to use custom post types only to keep things cleaner and more organized. (blog & services) and (Categories & Taxonomies) separate from each other. But not when I can't add the taxonomy to the url.
Can anybody at wp-types make my structure like this below?
Example.com/custom-type-slug/taxonomy/post
Dear users,
Chris, you say it worked over here:
https://toolset.com/forums/topic/custom-taxonomies-not-showing-on-permalink/#post-16949
Mido, does this work for you? Can we mark this one as resolved?
Regards,
Caridad
Dear Caridad,
thanks for your efforts but,
it's not working and got them both not found!
and this is not what i'm asking for any way...
what i need is to make tax and post type with the same base in the same level, like this
site.com/tax
site.com/tax/term
site.com/tax/post-of-posttype
tax = taxonomy custom template
term = term slug from the taxonomy
post-of-posttype = title slug of a post of a custom post type
may be it wasn't clear the first time sorry for that
Thanks,
Dear Mido,
In my first reply I said:
> I couldn't get it to work with site.com/tax/post-type, but it does work with site.com/post-type/tax
I think its a WordPress limitation and I wasnt able to work around it.
Please let me know if there is anything else that I can assist you with.
Regards.
Caridad