WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 months ago

#14991 new defect (bug)

extra_rules_top should take priority over extra_permastructs

Reported by: prettyboymp Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.1
Component: Rewrite Rules Keywords: has-patch dev-feedback
Focuses: Cc:

Description

Since extra_rules_top are specifically added instead of generated like the those from the extra_permastructs which runs through generate_rewrite_ruls(), shouldn't the extra_rules_top take priority in conflicts?

Attachments (3)

14991.diff (874 bytes) - added by prettyboymp 4 years ago.
14991.2.diff (967 bytes) - added by prettyboymp 4 years ago.
made sure top rules stayed first
14991.3.diff (2.0 KB) - added by prettyboymp 4 years ago.

Download all attachments as: .zip

Change History (10)

@prettyboymp4 years ago

comment:1 @scribu4 years ago

  • Keywords has-patch added

Makes sense.

comment:2 follow-up: @filosofo4 years ago

Won't that put the "top" rules last?

comment:3 in reply to: ↑ 2 @prettyboymp4 years ago

Replying to filosofo:

Won't that put the "top" rules last?

Good catch. Adding a new patch.

@prettyboymp4 years ago

made sure top rules stayed first

comment:4 @dd324 years ago

  • Keywords needs-patch added; has-patch removed

Using array_reverse like that looks like an ugly hack to me, If i'm understanding this correctly, perhaps we can add the permastructs to a separate array, and then merge it after the loop?

Reseting to needs-patch given this will be stale now (I've changed that block)

@prettyboymp4 years ago

comment:5 @prettyboymp4 years ago

  • Keywords has-patch added; needs-patch removed

Added updated patch. I went with dd32's suggestion of using a separate array for permastructs.

I switched to using the '+' operator instead of array_merge in the final rule merging. I would think this is the effect that was originally desired when this when this was created.

comment:6 @markjaquith4 years ago

  • Milestone changed from Awaiting Review to Future Release

comment:7 @chriscct75 months ago

  • Keywords dev-feedback added

Patch is still good to merge, and I like the idea behind this one. Tagging for re-review

Note: See TracTickets for help on using tickets.