Hi,
Please check the attached image.
Is it possible to set the parent slug for Products using a code snippet? In this case, it would be only brands.
I've searched and found this post, but Beda refers that when many-to-many implementation would be released that the code would need to be addapted: https://toolset.com/forums/topic/hierarchical-child-post-type-url/
Another question would be, if Yoast would aknowledge this changes in the permalink structure in it's sitemaps.xml as permanent?
thanks
Hi, in general I don't recommend hierarchical URL structures because they require custom code that we don't support here in the forum. With that being said, I can certainly show you how to use the new post relationships API to get the slug of a parent post, given some arbitrary child post ID. You will replace line 7 in that code sample with this:
$parentId = toolset_get_parent_post_by_type( $post->ID, 'parent-type-slug' );
Replace parent-type-slug with the slug of the parent post type. Let me know if you have any trouble using the post relationships API.
Thanks Christian, just one question.
Do you know if these changes reflect on Yoast SEO sitemaps?
I don't have any information about how these URL modifications impact Yoast sitemaps. That sounds like more of a question for Yoast's support team.