Taxonomies as url slug does not work
-
Hello,
I am trying to build url structure as following cases
- example.com/cpt-type/cpt categories/post-name
Say, the cpt type is cpt1, category base is cpt_category, and categories are cat1, cat2, and cat3.
The cpt and category base (taxonomy) are both defined by CPT UI.
I used following plugin to define CPT’s permalink structure.
For the case 1, my permal structure is following:
- Case 1: example.com/cpt1/%cpt_category%/%postname%
Since there are 3 categories in cpt_category, I thought the url will be
- example.com/cpt1/cat1/example-post-name
But in the browser URL, I can see
- example.com/cpt1/%cpt_category%/%postname%
In other words, ‘%cpt_category%’ is not considered as a variable, but as a string value. This might be the permalink plugin’s problem. So, I’ve tried the same thing with pre-made CPTs from a random glossary plugin. The plugin’s category base is ‘%glossary-cat%’, so I set the permal structure by following
- example.com/glossary/%glossary-cat%’/%postname%
Somehow, in this case, %glossary-cat% is replaced to cat1, cat2, and cat3 in the URL. So it looks like
- example.com/glossary/cat1/example-post-name
which means that ‘%glosary-cat%’ is not considered as a string value, but as a variable. My guess is that either I did something wrong in settings for CPT UI’s taxonomy, or there is some sort of a bug that WP does not capture CPT UI’s taxonomy.
Most likely, this should be my fault.
Let me share you how I set a taxonomy so that you can figure easily out what went wrong.
- Taxonomy Slug: example_category
- Plural Label: Example Categories
- Singluar Label: Example Category
- Attach to Post Type: Example CPT
- Menu Name: Example Category
- Hierarchical: True
- Rewrite Hierarchical: True
- Show Admin Colunn: True
- Show in tag cloud: True
- Show in quick/bulk edit panel: True
- Sort: True
Other setting values are unchanged from your default.
In fact, another plugin that is supposed to find CPT’s category base also fails to list up my CPT category bases. Above two cases are from my own version of debugging.
Can you please help me to resolve the issue?
- You must be logged in to reply to this topic.