Skip Navigation

[Resolved] Parent/Child URL structure

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1199921
Sem Título.png

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

#1199942

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.

#1209592

Thanks Christian, just one question.

Do you know if these changes reflect on Yoast SEO sitemaps?

#1209692

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.