[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

Plugin API: WP_Hook class

File Size: 552 lines (15 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.

since: 4.7.0
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.

since: 4.7.0
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.
since: 4.7.0
param: string   $hook_name The filter hook to which the function to be removed is hooked.
param: callable $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
since: 4.7.0
param: string         $hook_name Optional. The name of the filter hook. Default empty.
param: callable|false $callback  Optional. The callback to check for. Default false.

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.
since: 4.7.0

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

since: 4.7.0
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.
since: 4.7.0
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.

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

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

since: 4.7.0
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.
since: 4.7.0

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.
since: 4.7.0
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.
since: 4.7.0
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.
since: 4.7.0
param: mixed $offset The offset to retrieve.

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

since: 4.7.0
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.

since: 4.7.0
param: mixed $offset The offset to unset.

current()   X-Ref
Returns the current element.

return: array Of callbacks at current priority.
since: 4.7.0

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

return: array Of callbacks at next priority.
since: 4.7.0

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

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

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

return: bool Whether the current position is valid.
since: 4.7.0

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

since: 4.7.0



Generated: Sun Aug 1 01:00:05 2021 Cross-referenced by PHPXref 0.7.1