Sauter la navigation

[Résolu] Removing CPT slug makes child pages not work

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 5 années et 10 mois. 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)

Marqué : 

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par Bob Dowdy Il y a 5 années et 10 mois.

Assisté par: Shane.

Auteur
Publications
#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 (lien caché) 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

Les langues: Anglais (English )

Fuseau horaire: 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

Les langues: Anglais (English )

Fuseau horaire: 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 .
lien caché

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!