Changeset 52952 for trunk/src/wp-includes/plugin.php
- Timestamp:
- 03/18/2022 06:21:40 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/plugin.php
r52300 r52952 152 152 * 153 153 * @since 0.71 154 * @since 6.0.0 Formalized the existing and already documented `...$args` parameter 155 * by adding it to the function signature. 154 156 * 155 157 * @global WP_Hook[] $wp_filter Stores all of the filters and actions. … … 161 163 * @return mixed The filtered value after all hooked functions are applied to it. 162 164 */ 163 function apply_filters( $hook_name, $value ) {165 function apply_filters( $hook_name, $value, ...$args ) { 164 166 global $wp_filter, $wp_current_filter; 165 166 $args = func_get_args();167 167 168 168 // Do 'all' actions first. 169 169 if ( isset( $wp_filter['all'] ) ) { 170 170 $wp_current_filter[] = $hook_name; 171 _wp_call_all_hook( $args ); 171 172 $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection 173 _wp_call_all_hook( $all_args ); 172 174 } 173 175 … … 184 186 } 185 187 186 // Don't pass the tag name to WP_Hook.187 array_ shift( $args);188 // Pass the value to WP_Hook. 189 array_unshift( $args, $value ); 188 190 189 191 $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
Note: See TracChangeset
for help on using the changeset viewer.