[wp-trac] [WordPress Trac] #26673: Improve wp_parse_args() by adding filters before/after the array_merge()

WordPress Trac noreply at wordpress.org
Wed Dec 18 17:40:27 UTC 2013


#26673: Improve wp_parse_args() by adding filters before/after the array_merge()
-----------------------------------+------------------
 Reporter:  johnjamesjacoby        |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  3.9
Component:  Plugins                |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------
Description changed by johnjamesjacoby:

Old description:

> I'd like to be able to modify existing WordPress core functionality
> without needing to:
>
> * Rewrite functions
> * Make a child theme to replace one template file
> * Searching through code and finding there is no filter where I need one
>
> We use `wp_parse_args()` to parse an `$args` parameter against default
> known parameters for some functionality. bbPress's `bbp_parse_args()`
> function applies filters before and after the `array_merge()` which
> allows for just-in-time or brute-force filtering of parsed arguments.
> Each call to `bbp_parse_args()` includes a unique string so each call has
> unique filters applied to them.
>
> This introduces invisible flexibility for each call to `wp_parse_args()`
> when a unique string is passed. If no string is passed, no filters are
> applied, meaning it's completely backwards compatible and allows for
> filters to be rolled in on a case by case basis later.
>
> Patch incoming

New description:

 I'd like to be able to modify existing WordPress core functionality
 without needing to:

 * Rewrite functions
 * Make a child theme to replace one template file
 * Searching through code and finding there is no filter where I need one

 We use `wp_parse_args()` to parse an `$args` parameter against default
 known parameters for some functionality. bbPress's `bbp_parse_args()`
 function applies filters before and after the `array_merge()` which allows
 for just-in-time or brute-force filtering of parsed arguments. Each call
 to `bbp_parse_args()` includes a unique string so each call has unique
 filters applied to them.

 The incoming patch introduces invisible flexibility for each call to
 `wp_parse_args()` when a unique string is passed. If no string is passed,
 no filters are applied, meaning it's completely backwards compatible and
 allows for filters to be rolled in on a case by case basis later.

--

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26673#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list