Skip Navigation

[Resolved] Remove category slug from URL of custom Taxonomies

This thread is resolved. Here is a description of the problem and solution.

Problem:

I've created two custom category taxonomies and am looking for a setting to prevent the taxonomy slug from showing in the URL.

Solution:

There isn't such kind of built-in feature within Toolset, you can try other plugin, for example:

https://wordpress.org/plugins/remove-taxonomy-base-slug/

Relevant Documentation:

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 3 voices.

Last updated by julesW 3 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2215269

I've created two custom category taxonomies and am looking for a setting to prevent the taxonomy slug from showing in the URL. Is there one? If not is there a custom function I can use to prevent it from showing?

Thank you,
Jules

#2215543

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Do you mean for the URLs of the taxonomy archives?

So if you have a, say, colour taxonomy and a size taxonomy, the taxonomy archives appear at URLs such as

site.com/colour/red and site.com/size/small.

You can change what is used to distinguish the taxonomies, so instead of using the slugs in the rewrite settings for the custom taxonomy you can specify something other than the slug.

But you need something to differentiate them.

If you aim to have nothing to indicate the taxonomy the terms belong to, you would need to go down the route of creating custom rewrite rules, see https://developer.wordpress.org/apis/handbook/rewrite/

#2215571

Hello,

Please let me know if you still need assistance for it, thanks

#2216089

Hi Luo

Yes, please. I could use some additional help.

At the bottom of https://developer.wordpress.org/reference/functions/user_trailingslashit/
There is an example function that removes "category" from the URL

I have a custom post type "litters" with a taxonomy of "litter-status" with 3 options "current" "future" and "past"

so the URL is mydomain.com/litter-status/current

I would like the URL to be mydomain.com/current

I've tried modifying the example function, but am unable to get it to work with the custom post type taxonomy. (it does work with the native "category" URL)

Is this something you can help me with?

Thank you for your time!
Jules

#2216369

There isn't such kind of built-in feature within Toolset, and I have searched it in google, found this plugin:
https://wordpress.org/plugins/remove-taxonomy-base-slug/
It should be able achieve what you want.

#2216915

Thank you!