Opened 11 years ago
Closed 11 years ago
#25011 closed enhancement (fixed)
Unnecessary foreach loops in default-filters.php
Reported by: | Jayjdk | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | minor | Version: | 2.2.3 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
In two cases, defaults-filters.php runs a foreach loop even through there's only one item in the array.
I don't know if it's just me but that seems unnecessary.
// Slugs foreach ( array( 'pre_term_slug' ) as $filter ) { add_filter( $filter, 'sanitize_title' ); } ... // Format for RSS foreach ( array( 'term_name_rss' ) as $filter ) { add_filter( $filter, 'convert_chars' ); }
Slugs code introduced in [5937] and the feed code in [5979].
The code was last changed in [12041].
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
I imagine this was done to make it easy to add elements here in the future. Given the lack of changes in the last 6.5 years, I think it is safe to go ahead with 25011.patch.
For those laughing at [12041], you may enjoy the follow-up more: [12042].