Enhance wp_parse_args() by adding filters before/after the array_merge()
|Reported by:||johnjamesjacoby||Owned by:|
Description (last modified by johnjamesjacoby)
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.
Change History (24)
- Summary changed from Improve wp_parse_args() by adding filters before/after the array_merge() to Enhance wp_parse_args() by adding filters before/after the array_merge()