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

WordPress Trac noreply at wordpress.org
Mon May 29 04:50:34 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 moeloubani1):

 An easy way to do this would be to set a flag when registering the post
 type and if it is set then just add another rewrite rule that looks for
 the pagename and also checks it against that post type so that instead of
 404 erroring after it checks to see if the page exists it checks one more
 time to see if it exists with post_type=nameofposttype and
 nameofposttype=url/that/was/requested

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


More information about the wp-trac mailing list