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
https://toolset.com/forums/topic/custom-taxonomies-not-showing-on-permalink/#post-16949
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
/shop/%watch-category%/
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);
}