Skip Navigation

[Resolved] Remove post type slug from post URL

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to remove the post type slug from my single post URL

Solution: Toolset can help you change the post type slug, but not remove it entirely. WordPress depends on slugs like this to differentiate between post, archive, and page URLs. Bypassing this system will require some complex rewrite rules that we do not provide here in the support forums.

Relevant Documentation:
https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

This support ticket is created 6 years, 10 months ago. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Jorge Pecora 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#607646

Hi:
I have created custom post types for each city.
Within each city (post type) there are the corresponding hotels.
Then the path stays: domain. com/city/hotel-xx
But for convenience (very long city names) I would like to keep it: domain. com/hotel-xx
Is it possible to do this?
If it were possible, would you please tell me how to do it?
Thank you.
Jorge

#607701

Hi, the standard WordPress URL structure requires a directory slug like "city" in order for its standard rewrite rules to work as expected. Without the directory in place, it will take some complex rewrite rules to differentiate between CPT URLs, Page URLs, and archive URLs. That type of URL customization isn't something we offer here in the support forums. We can help you modify the directory to be something else, but not remove it entirely. If you need professional assistance with that, you may be able to connect with a contractor in our contractors portal: https://toolset.com/contractors/

#608526

Thank you very much, Christian. You've cleared my mind.