Skip Navigation

[Resuelto] Changing URL slug for custom post type

This support ticket is created hace 2 años, 10 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por zeljko-turkaljS hace 2 años, 10 meses.

Asistido por: Shane.

Autor
Mensajes
#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

enlace oculto

Can we somehow shorten this URl to something like this, we would like to avoid /broker/ in URL.
enlace oculto

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

Idiomas: Inglés (English )

Zona horaria: 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

Idiomas: Inglés (English )

Zona horaria: 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!