[Closed] Custom taxonomy permalinks

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.


This topic contains 6 replies, has 2 voices, and was last updated by  Noman 5 months, 1 week ago. The support staff assigned to this topic is Noman.

Viewing 7 posts - 1 through 7 (of 7 total)

Please reopen my ticket


which is now closed. Tried to post a new reply but I get an error. Thank you.


Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hi Aris,

Thank you for contacting us. We can continue our discussion here. Please let me know what you require further in regards to original details provided earlier.

Thank you


Thank you. Sorry for not keeping the thread alive (I got all the warnings but I was away).

In response to your last message,
thank you for providing this resource. Indeed this is a step towards the right direction. But I still don't get the desired result.

(Of course in this link you suggested
the solution applies also in the case where both custom taxonomies and custom post types are used. In my case I do not use custom post types, I stick to WC products).

I guess the only addition is the code part. All other settings are WP Types defaults (if I'm not mistaken).
The code successfully allowed us to use the custom taxonomy slug in WP's permalinks. So in my case I used


as custom base.

However the end result is (for a single product):

<em><u>hidden link</u></em>

To clarify, the hierarchy is 'Watch -> Men'. The respective slugs are 'watch' and 'watch-mens'.

As you can see the custom code shows only the last child (the subcategory) and not the whole hierarchy. It should be something like

<em><u>hidden link</u></em>

I understand this is not in WP Types context but I still would appreciate your help as I am rather new to WP direct coding.

Thanks again

PS: The code I have used is this:

add_filter('post_link', 'watchcategory_permalink', 10, 3);
add_filter('post_type_link', 'watchcategory_permalink', 10, 3);
function watchcategory_permalink($permalink, $post_id, $leavename) {
        if (strpos($permalink, '%watch-category%') === FALSE) return $permalink;

        // Get post
        $post = get_post($post_id);
        if (!$post) return $permalink;
        // Get taxonomy terms
        $terms = wp_get_object_terms($post->ID, 'watch-category');
        if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
        else $taxonomy_slug = 'other';
        return str_replace('%watch-category%', $taxonomy_slug, $permalink);

Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Thanks for providing more details. Please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site), so that I can look into your setup and check this further. Please note that we do not debug custom code or custom requirements much as per our support policy (https://wp-types.com/toolset-support-policy/) but I would like to take a look and see what I can find.

Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please also provide links to your Taxonomy, Product, CPT that you would like to use, anything that's needed for this.

Thank you


Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Aris,

I have done more testing on getting the required URL. Since we are using WooCommerce I find out that the solution given here won’t going to help much: https://wp-types.com/forums/topic/custom-taxonomies-not-showing-on-permalink/#post-16949

Here is why:
- Above solution will give us url like: hidden link
- Which means it will give us url like: hidden link
(which is we don’t need).

- We need url like this: hidden link
So I managed to achieve this result with an alternate way, I tried various things and codes but only this is what possible as long as its for your current requirements and I think it's good, I have made a short video explaining what I have done here:
hidden link

A related video I found:
hidden link



Dear Noman,
I reviewed your last post thoroughly. I don't follow though. I couldn't pinpoint any action besides the defaults. I am not famous for my observing capabilities...so please let me know what exactly differentiates the actions in your video from the defaults.
In any case I would appreciate if you could keep this thread open as due to personal issues I am not able to review and reply in a timely manner.

In any case I really appreciate your time and effort.


Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Aris,

In the video basically I have shown how to get the url as you need:
hidden link

And yes I have used built-in options, the main thing is creating a Custom taxonomy and setting up categories hierarchy. The custom code solutions we found previously are not useful in the end. So that’s all we can do to get the url structure you need.

Other than that if you are not comfortable with the solution I have used to get that url above, rest falls into pure Custom coding & custom development and it is out of support policy (https://wp-types.com/toolset-support-policy/). So we recommend to contact Toolset recommended service providers to further discuss the custom approach. We have some recommended list of service providers here if you would like to take a look: https://wp-types.com/consultant/


Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘[Closed] Custom taxonomy permalinks’ is closed to new replies.