WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 8 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 needs-unit-tests
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 6 years ago.
14991.2.diff (967 bytes) - added by prettyboymp 6 years ago.
made sure top rules stayed first
14991.3.diff (2.0 KB) - added by prettyboymp 6 years ago.

Download all attachments as: .zip

Change History (11)

@prettyboymp
6 years ago

#1 @scribu
6 years ago

  • Keywords has-patch added

Makes sense.

#2 follow-up: @filosofo
6 years ago

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

#3 in reply to: ↑ 2 @prettyboymp
6 years ago

Replying to filosofo:

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

Good catch. Adding a new patch.

@prettyboymp
6 years ago

made sure top rules stayed first

#4 @dd32
6 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)

@prettyboymp
6 years ago

#5 @prettyboymp
6 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.

#6 @markjaquith
6 years ago

  • Milestone changed from Awaiting Review to Future Release

#7 @chriscct7
22 months ago

  • Keywords dev-feedback added

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

#8 @chriscct7
8 months ago

  • Keywords needs-unit-tests added
Note: See TracTickets for help on using tickets.