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
hidden link
Can we somehow shorten this URl to something like this, we would like to avoid /broker/ in URL. hidden link
Please keep in mind, office in URL is not page, it is multisite in WP multisite environment.
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.
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.