Navigation überspringen

[Gelöst] Changing URL slug for custom post type

This support ticket is created vor 3 Jahren. 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)

Dieses Thema enthält 5 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von zeljko-turkaljS vor 3 Jahren.

Assistiert von: Shane.

Author
Artikel
#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

versteckter Link

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

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

Sprachen: Englisch (English )

Zeitzone: 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

Sprachen: Englisch (English )

Zeitzone: 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!