Skip Navigation

[Closed] Custom taxonomy and post type with same slug

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 11 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 5 replies, has 3 voices.

Last updated by Caridad 11 years, 7 months ago.

Assisted by: Caridad.

Author
Posts
#16853

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

#16928

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:

post-type/%tax%

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

#16944

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

#16961

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

#16973

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,

#17081

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

The topic ‘[Closed] Custom taxonomy and post type with same slug’ is closed to new replies.