Skip Navigation

[Resolved] Taxonomy Permalink BUG affects on CPT

This support ticket is created 4 years, 4 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/Karachi (GMT+05:00)

Author
Posts
#1728633

I am trying to Change Taxonomy Permalink without a base
hidden link
to
hidden link

It works, but it affect CPT permalink not to work, while visiting CPT single link it returns a 404 error.
The CPT permalink is the not altered anywhere. It only doesn't work on CPT single link just if removing taxonomy base or changing url structure to /

P.s.
I use Elementor to style single template, i don't know if it is correlated

#1729095

Hi,

Thank you for contacting us and I'd be happy to assist.

Based on what you've shared, this isn't a bug but a conflict in how permalink rewrites are handled in WordPress.

When the permalink settings ( WP Admin -> Settings -> Permalink ) is set to "Post name" ( screenshot: hidden link ), WordPress expects the single post URL to consist of a structure where the base URL is immediately followed post's slug:
yourwebsite.com/{post-slug}

However, when we remove the taxonomy's slug from its permalink and change its URL structure from:
yourwebsite.com/{taxonomy-slug}/{term-slug}

To:
yourwebsite.com/{term-slug}

This brings in conflict with a single Post's URL structure since WordPress will now start expecting the first query var that follows the base URL to be {term-slug} and not {post-slug}.

To avoid this, you'll need to include some fixed base query var either for single post permalinks or the taxonomy permalinks.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1731749

Sorry But i don't understand

#1733079

Thanks for writing back and I apologize if my last message didn't help.

Can you please let me know exactly which point wasn't clear from that message and I'll explain that in more detail.

It would also help if you could share a screenshot of your website's permalink settings at WP Admin -> Settings -> Permalink.

#1737257

I need to eliminate the slug from the cities

hidden link to hidden link

#1738289
taxonomy-edit-screen.png

To remove the taxonomy slug (citta), please go to WP Admin -> Toolset -> Taxonomies and select the "Cities" taxonomy for editing.

On the taxonomy's edit screen, you'll see an input field below the "Rewrite" option.

As shown in the attached screenshot, please include / in that field and save the settings and slug will be removed.

#1741641

Exactly what i did... there is a bug, because the city of the taxonomy city now is hidden link
but when i try to visit the post type location
E.G. hidden link it doesn't work

#1741645
Schermata 2020-08-17 alle 10.35.59.png

Now i would apply, as you mentioned, a different permalink for posts and not for all type of posts. Because the bug is there.
When i modify permalinks in wordpress core it affects also on all the site.

I tryed to put before /blog/ to change the structure of the posts but it affects all the site, also if i modified CPT permalink structure

#1741901

Thanks for the update and this is exactly what I explained would happen in my first reply.
( ref: https://toolset.com/forums/topic/taxonomy-permalink-bug-affects-on-cpt/#post-1729095 )

When you remove the base taxonomy slug from the URL of term archive pages, WordPress would expect the first word after the website's URL ( hidden link ) to be a term's slug.

And when visiting any other single post type page, it doesn't find any term's slug with the same name and therefore shows page not found message.

Likewise, when you'll update the permalink settings, it will affect the single post URLs for all the post types and not just any specific post type.

Again, this is not Toolset's bug but is actually the limitation of how WordPress manages redirection and URLs.

Note: Removing the base taxonomy slug is generally not recommended as it will conflict with other permalinks and can also result in performance penalties, so I'll not recommend going with this option.
( ref: https://wordpress.stackexchange.com/a/311872 )

If you'd still like to go with this requirement, I also found this code snippet online which you can use on your own risk:
hidden link