Skip Navigation

[Resolved] Removing CPT slug makes child pages not work

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user has an inbuilt hierarchical post relationship and wanted to remove the parent slug from the posts.

Solution:

This was resolved by using the following .
https://wordpress.org/plugins/permalink-manager/

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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Bob Dowdy 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1202756

Hello,

I know this is probably outside the realm of your support, but I'm really hoping you can help me.

Using the PHP code I found here (hidden link) I have removed the slug for my CPT called "office". So now /office/name-of-office/ becomes /name-of-office/

The issue I am running into is I can't get the child pages of /name-of-office/ to load (404 or WordPress redirects it to some similarly named page). I have tried every snippet of PHP that you all have linked to in previous support forums, as well as everything I can find on stack overflow.

This site I'm working on has both listings and sold items nested as child pages under each office, so /name-of-office/listings and /name-of-office/listings/sold/

Thanks in advance,
Corey

#1203380

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Bob,

Thank you for contacting our support forum.

Actually I would recommend seeking help from our registered contractors with this as I know that child posts usually require the parent in the url.

These child posts are of the same post type correct and not a different CPT?

Please let me know.
Thanks,
Shane

#1203480

Yes, these are the same CPT.

I am not Bob actually, I'm a developer working on his project. Do you have an estimate for how much that would cost?

There are several freely provided solutions for this online, but none work.

#1204104

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi,

I believe you are getting this issue because the child post permalink is saved with the parent post in it.

Take a look here .
hidden link

This archive might assist with getting the parent name removed from the permalink to allow it to start working again.

Please let me know if this helps.
Thanks,
Shane

#1208026

Thanks Shane,

That plugin pointed me in the right direction, and I found the perfect plugin to fit my needs. It allows for permastructures that kick in automatically when a specific CT is saved/updated:

https://wordpress.org/plugins/permalink-manager/

My issue is resolved.

Best,
Corey

#1208027

My issue is resolved now. Thank you!