[wp-trac] [WordPress Trac] #42478: Add_permastruct ignores EP_NONE and other args if %post_id% is present in struct

WordPress Trac noreply at wordpress.org
Wed Nov 8 22:15:22 UTC 2017


#42478: Add_permastruct ignores EP_NONE and other args if %post_id% is present in
struct
----------------------------+-----------------------------
 Reporter:  Underscorefunk  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Rewrite Rules   |    Version:  4.9
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 Additional rewrite rules are made if the %post_id% is in a struct passed
 to add_permastruct. This happens because generate_rewrite_rules (called in
 to process the permastructs) assumes anything with %post_id% in its struct
 is a post and should have attachments, talkbacks, comments, etc. I suspect
 it's holdover from when %post_id% and p= only referred to posts and
 post_ids from the wp_posts table at large.

 I have a simple enough solution.

 Add another default rewrite_tag that generates the 'p=' query but doesn't
 trigger the additional rewrites.

 i.e. add_rewrite_tag( '%p%', '([0-9]+)', 'p=' );

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42478>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list