Opened 9 years ago
#42478 new defect (bug)
Add_permastruct ignores EP_NONE and other args if %post_id% is present in struct
| Reported by: | Underscorefunk | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Rewrite Rules | Version: | 4.9 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
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=' );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)