Skip Navigation

[Resolved] Remove custom taxonomy slugs

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

Problem:
Client would like to remove the taxonomy slug from a custom taxonomy archive URL.

Solution:
This is not supported by WordPress, to prevent possible ambiguity when interpreting URLs.

However, it can be made to work (with risks) using custom redirects, as described here (https://wordpress.stackexchange.com/a/57186/35739) or as used in this plugin: https://wordpress.org/plugins/remove-taxonomy-base-slug/

This support ticket is created 6 years, 7 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by chrisB-30 6 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#903770

Yep that did the trick... Thanks!

It is a bit of a hack on the back-end but it renders fine on the front end. Add my vote to the feature request!

The only unexpected byproduct of switching to category pages is that my URLs are not falling in line. I'm not sure if I should ask this question in this ticket or start a new one as it is a different (yet related issue) - I will ask here for expediency - just let me know if you want me to move it to a new ticket.

URL Issue

Just as a refresher here is my structure in Toolset:

Post Type = Brides
Taxonomy = Location
My locations have 2 levels (Region ie, Asian, Latin, African, Euro) and Country (ie, Colombia, Cuba etc)

My hierarchey is like this: Brides - Region - Country - Entry Title

I am using Yoast Breadcrumbs - which is creating the correct hierarchy as you can see on an entry page like this one:
hidden link

I am happy with the url structure for the entry pages as shown above - the problem is with the Region and Country pages which appear like this:
hidden link
hidden link

Is there any way to get rid of "locations" in the url so they would render as:
hidden link
hidden link

I know there are plugins for wordpress that will rewrite urls on an individual basis - but I am trying to stay away from too many hacks on my site.

I could probably live with:
hidden link
hidden link

I tried adding "brides" as a rewrite base in the location taxonomy settings but it just threw up 404 errors - I assume because it was conflicting with the brides post type.

Any ideas?

Thanks

#903782

Nigel
Supporter

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

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

Hi Chris

WordPress doesn't support removing the taxonomy slug, and so is not an option with Toolset.

A slug is required to avoid ambiguity when determining what to display at a given URL (e.g. a post or a taxonomy archive).

The WordPress way, supported by Toolset, allows you to use an alternative string than the taxonomy slug which you can specify when editing the taxonomy settings in the options panel.

In your example you changed location to brides, but brides is already used as the slug of the custom post type. You could try an alternate string (e.g. "ladies"), or...

You could try to write custom rewrite rules, as described here: https://wordpress.stackexchange.com/a/57186/35739

Or use a plugin that provides such functionality, e.g. https://wordpress.org/plugins/remove-taxonomy-base-slug/

#904202

That's kinda what I thought you would say. I will ponder the options.

Thanks!