[wp-trac] [WordPress Trac] #34136: Allow register_post_type's rewrite to remove CPT slug

WordPress Trac noreply at wordpress.org
Mon May 29 22:36:52 UTC 2017


#34136: Allow register_post_type's rewrite to remove CPT slug
---------------------------+------------------------------
 Reporter:  BenRacicot     |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:  4.3.1
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by michael.ecklund):

 I guess I don't understand why you wouldn't just use the built-in
 hierarchical Post Type (`page`) for that.

 Replying to [comment:3 drzraf]:
 > Use-case: we have restaurants and had to ''tweak'' the rewrite (cf OP)
 in order to have provide URL like:
 > {{{
 > /<city>/<slug>
 > }}}
 > rather than the much more cumbersome:
 > {{{
 > /restaurant/<city>/<slug>
 > }}}
 > That best represents the main goal of the website which has no value
 being artificially namespaced.
 >
 > We also have a couple of other CPT of less significance (and none of
 them is named after a city) so that conflict are not going to be an issue
 (or at least a minor issue in comparison to having clean URL)
 >
 > Having an officially-supported way to omit the CPT URL's segment would
 be appreciated.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34136#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list