Skip Navigation

[Résolu] Changing URL slug for custom post type

This support ticket is created Il y a 2 années et 7 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

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

Dernière mise à jour par zeljko-turkaljS Il y a 2 années et 7 mois.

Assisté par: Shane.

Auteur
Publications
#2244401

Hi guys, maybe this questions was already answered, if yes, apologies.

I have custom post type Broker. We will have WordPress multisite environment and in every environment we will have this custom post type. When we display single content template for that custom post type Broker the URL is for example

lien caché

Can we somehow shorten this URl to something like this, we would like to avoid /broker/ in URL.
lien caché

Please keep in mind, office in URL is not page, it is multisite in WP multisite environment.

Any help is appreciated

Best regards
Sasa Vidakovic
Deal Studio

#2244533

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Sasa,

Thank you for getting in touch.

Unfortunately no this won't be possible for custom post types.

Custom Post types require their base slug be added to the URL as the wordpress default post doesn't use a base slug. This helps to avoid URL conflicts among different post types, so you won't be able to remove this.

Thanks,
Shane

#2245071

Thanks Shane,

so the only available option in this moment is manual mapping of 301 redirects rules.

Best regards
Sasa Vidakovic
Deal Studio

#2245261

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Sasa,

That is correct however you run the risk of an infinite redirection if you have the wordpress default post having the same post slug as your custom post.

Let's say you have a post in the default wordpress post type called "My Job" the slug will be "my-job" and on your custom post type you have a post with that exact same Title, then it will generate with the same slug.

Normally no conflicts will happen because the full url in both cases will be.
example.com/my-job <- default post

example.com/cpt/my-job <- Custom post type

However if you're going to redirect example.com/cpt/my-job to example.com/my-job then you will introduce a conflict where wordpress may end up displaying the default post type post rather than your custom post type.

Thanks,
Shane

#2245457

Thanks Shane

#2245459

My issue is resolved now. Thank you!

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance