Skip Navigation

[Resolved] post type is a part of the URL

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Waqar 1 year, 2 months ago.

Assisted by: Waqar.

Author
Posts
#2548857
screenshot 202302061639.png

I've build several post types - one of them called Manuals.

When I see the URL is says hidden link

I would like the URL instead to be /ergonomics-risk-assessment/ - ergo to loose /manual/

I've opened "Edit Post Type" under "Options" and tried to rewrite it via custom URL (and keep the field empty) but it doesn't work.

What do I do?

#2549263

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

permalink-settings-no-post-type-slug.png

Hi,

Thank you for contacting us and I'd be happy to assist.

To remove the post type's slug from the URL of a post type, you can include a forward slash '/' in the "Use a custom URL format" field, as shown in the screenshot.

After making this change, please flush WordPress rewrite rules by clicking the "Save Changes" button at WP Admin -> Settings -> Permalinks and then check that post's URLs.

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

#2549417

Hi Waqar.
Thank you for your reply.
I have tried with '/' and it works on this post type - but when I do it on other post types I have built all the links tells me that the pages are not found any more.
I have now reset all post types back to wordpress standards and links works again. What do I do wrong?
Best regards
Kristen

#2549687

Hi again Waqar.

Just to make sure I followed your instructions in your earlier reply - also about clicking save button at WP Admin -> Settings -> Permalinks and then check that post's URLs.

I tried it again tonight with only post type Manuals and it ended up in a fail.

Normally the topmenu "Ergonomics" points to this URL: hidden link

But when I tried '/' (only using the / in the "Use a custom URL format" field) the menu now showed this URL:
hidden link

That is the same URL as the French ergonomics page here:
hidden link

#2550813

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

What you're experiencing is the limitation of how WordPress permalinks and slugs handling logic works.

It is a good/safe practice to keep the post-type slug (e.g. /manual/ ) in the URL so that the permalinks rewrite rules know exactly which post-type slugs to look for.

e.g.

website.com/{post-type-slug}/{individual-post-slug}

But, when we skip the {post-type-slug} part, the rewrite rules try to find the nearest possible slug from all post types, including the default post types like regular pages and posts.
( priority is given to custom post-type slugs over the slugs of the regular pages, which is exactly what you experienced in the case of the 'Ergonomics' page )

To avoid conflicts like these between the similar or same slugs from different post/page items on the website, I'll recommend keeping the {post-type-slug} part of the custom post links.

I hope this makes sense and please let me know if you have any follow-up questions.

#2550821

Hello again Waqar.
If I understand this correctly then I can't remove /manual/ from the URL?
That will be a true dissapointment from the customer if that is so.
Best regards Kristen

#2551789

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Unfortunately, there is no straightforward way to achieve this.

You'll have to rely on some custom rewrite rule workarounds, as discussed in the following resource:

hidden link
https://wordpress.stackexchange.com/questions/203951/remove-slug-from-custom-post-type-post-urls

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.