| 316 | * Retrieve the name of a filter currently being processed. |
| 317 | * |
| 318 | * The function current_filter() only returns the most recent filter |
| 319 | * or action being executed. did_action() returns true once the action |
| 320 | * is initially processed. This function allows detection for any filter |
| 321 | * currently being executed (despite not being the most recent filter to |
| 322 | * fire, in the case of hooks called from hook callbacsk) to be verified. |
| 323 | * |
| 324 | * @since 3.2.0 |
| 325 | * @see current_filter() |
| 326 | * @see did_action() |
| 327 | * |
| 328 | * @param $filter string Filter to check |
| 329 | * @return bool Whether the filter is currently in the stack |
| 330 | */ |
| 331 | function doing_filter( $filter ) { |
| 332 | global $wp_current_filter; |
| 333 | return in_array( $filter, $wp_current_filter ); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Retrieve the name of an action currently being processed. |
| 338 | * |
| 339 | * @since 3.2.0 |
| 340 | * @uses doing_filter() |
| 341 | * |
| 342 | * @param $action string Action to check |
| 343 | * @return bool Whether the action is currently in the stack |
| 344 | */ |
| 345 | function doing_action( $action ) { |
| 346 | return doing_filter( $action ); |
| 347 | } |
| 348 | |
| 349 | /** |