[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-hook.php (summary)

Plugin API: WP_Hook class

File Size: 584 lines (16 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 20 functions

  add_filter()
  resort_active_iterations()
  remove_filter()
  has_filter()
  has_filters()
  remove_all_filters()
  apply_filters()
  do_action()
  do_all_hook()
  current_priority()
  build_preinitialized_hooks()
  offsetExists()
  offsetGet()
  offsetSet()
  offsetUnset()
  current()
  next()
  key()
  valid()
  rewind()

Functions
Functions that are not part of a class:

add_filter( $hook_name, $callback, $priority, $accepted_args )   X-Ref
Adds a callback function to a filter hook.

param: string   $hook_name     The name of the filter to add the callback to.
param: callable $callback      The callback to be run when the filter is applied.
param: int      $priority      The order in which the functions associated with a particular filter
param: int      $accepted_args The number of arguments the function accepts.

resort_active_iterations( $new_priority = false, $priority_existed = false )   X-Ref
Handles resetting callback priority keys mid-iteration.

param: false|int $new_priority     Optional. The priority of the new filter being added. Default false,
param: bool      $priority_existed Optional. Flag for whether the priority already existed before the new

remove_filter( $hook_name, $callback, $priority )   X-Ref
Removes a callback function from a filter hook.

return: bool Whether the callback existed before it was removed.
param: string                $hook_name The filter hook to which the function to be removed is hooked.
param: callable|string|array $callback  The callback to be removed from running when the filter is applied.
param: int                   $priority  The exact priority used when adding the original filter callback.

has_filter( $hook_name = '', $callback = false )   X-Ref
Checks if a specific callback has been registered for this hook.

When using the `$callback` argument, this function may return a non-boolean value
that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.

return: bool|int If `$callback` is omitted, returns boolean for whether the hook has
param: string                      $hook_name Optional. The name of the filter hook. Default empty.
param: callable|string|array|false $callback  Optional. The callback to check for.

has_filters()   X-Ref
Checks if any callbacks have been registered for this hook.

return: bool True if callbacks have been registered for the current hook, otherwise false.

remove_all_filters( $priority = false )   X-Ref
Removes all callbacks from the current filter.

param: int|false $priority Optional. The priority number to remove. Default false.

apply_filters( $value, $args )   X-Ref
Calls the callback functions that have been added to a filter hook.

return: mixed The filtered value after all hooked functions are applied to it.
param: mixed $value The value to filter.
param: array $args  Additional parameters to pass to the callback functions.

do_action( $args )   X-Ref
Calls the callback functions that have been added to an action hook.

param: array $args Parameters to pass to the callback functions.

do_all_hook( &$args )   X-Ref
Processes the functions hooked into the 'all' hook.

param: array $args Arguments to pass to the hook callbacks. Passed by reference.

current_priority()   X-Ref
Return the current priority level of the currently running iteration of the hook.

return: int|false If the hook is running, return the current priority level.

build_preinitialized_hooks( $filters )   X-Ref
Normalizes filters set up before WordPress has initialized to WP_Hook objects.

The `$filters` parameter should be an array keyed by hook name, with values
containing either:

- A `WP_Hook` instance
- An array of callbacks keyed by their priorities

Examples:

$filters = array(
'wp_fatal_error_handler_enabled' => array(
10 => array(
array(
'accepted_args' => 0,
'function'      => function() {
return false;
},
),
),
),
);

return: WP_Hook[] Array of normalized filters.
param: array $filters Filters to normalize. See documentation above for details.

offsetExists( $offset )   X-Ref
Determines whether an offset value exists.

return: bool True if the offset exists, false otherwise.
param: mixed $offset An offset to check for.

offsetGet( $offset )   X-Ref
Retrieves a value at a specified offset.

return: mixed If set, the value at the specified offset, null otherwise.
param: mixed $offset The offset to retrieve.

offsetSet( $offset, $value )   X-Ref
Sets a value at a specified offset.

param: mixed $offset The offset to assign the value to.
param: mixed $value The value to set.

offsetUnset( $offset )   X-Ref
Unsets a specified offset.

param: mixed $offset The offset to unset.

current()   X-Ref
Returns the current element.

return: array Of callbacks at current priority.

next()   X-Ref
Moves forward to the next element.

return: array Of callbacks at next priority.

key()   X-Ref
Returns the key of the current element.

return: mixed Returns current priority on success, or NULL on failure

valid()   X-Ref
Checks if current position is valid.

return: bool Whether the current position is valid.

rewind()   X-Ref
Rewinds the Iterator to the first element.




Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref