Make WordPress Core

Opened 7 years ago

#42478 new defect (bug)

Add_permastruct ignores EP_NONE and other args if %post_id% is present in struct

Reported by: underscorefunk's profile Underscorefunk Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Rewrite Rules Keywords:
Focuses: Cc:


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=' );

Change History (0)

Note: See TracTickets for help on using tickets.