Skip Navigation

[Resuelto] Using custom taxonomy slug in custom post type permalink

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.

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
Can placeholders like %%taxonomy%% be used in Toolset > Post Types (or Taxponomies) > Rewrite Options?

Solution:
No. WordPress does not allow rewrite of Custom Posts and Taxonomies dynamically.
It can only be prepended (in the CPT case) or overwritten (in the taxonomy case)

This support ticket is created hace 6 años, 11 meses. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 respuestas, has 2 mensajes.

Last updated by Joff hace 6 años, 11 meses.

Assisted by: Beda.

Autor
Mensajes
#520949

I want to be able to create a custom taxonomy (e.g. 'manufacturers') and custom post type (e.g. 'products') and have the taxonomy title (instead of the slug) used in the post type permalink.

By default this shows the post type as the slug: /products/blue-widget/
But instead I want it to be: /best-widget-co/blue-widget/ (Where 'best-widget-co' is a manufacturers taxonomy value).

I tried setting the taxonomy in the post type Rewrite option as "/%manufacturer%" which outputs:

/%manufacturer%/blue-widget/

I then followed a guide on translating the custom taxonomy (hidden link) which rewrites the URL correctly as: /best-widget-co/blue-widget/ but when trying to access that page I get a 404.

Can you explain where I'm going wrong please?

#521069

That is not possible with Custom Posts and taxonomies.

This is a WordPress restriction.

What you can do is not as dynamic, but it is the only what you can do with Custom Data:
- head to Toolset > Post Types > your_post_type > Edit > Options > Rewrite.
Here you can use hard coded strings. Not dynamic placeholders as %%term%%. Only hard coded strings. And those will be prepended to the actual Post Slug.

The same you can do in Taxonomies.
There, you can replace the Taxonomy Slug with another, hard coded (not dynamic) string.

#521260

Hi Beda,

Thanks for the response. I was sure I'd seen a solution to this in the past so I've been doing some further research and it seems I was on the right track before but my implementation was slightly out.

You're right that the URL can't be fully dynamic (and everyone else seems to have the same advice) but if I prepend the CPT slug to the CPT's rewrite rule: products/%manufacturer% then this seems to work and will hopefully be an acceptable solution to my end client.

FYI the "solution" to this had previously been posted on the Toolset support forum at: https://toolset.com/forums/topic/custom-taxonomies-not-showing-on-permalink/#post-16949

Thanks again!

El foro ‘Types Community Support’ está cerrado y no se permiten nuevos debates ni respuestas.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.