Loader
Class defining action/filter registration for the plugin.
Maintain a list of all hooks that are registered throughout the plugin, and register them with the WordPress API. Call the run function to execute the list of actions and filters.
Tags
Table of Contents
- $actions : array<string|int, mixed>
- The array of actions registered with WordPress.
- $filters : array<string|int, mixed>
- The array of filters registered with WordPress.
- __construct() : mixed
- Initialize the collections used to maintain the actions and filters.
- add_action() : mixed
- Add a new action to the collection to be registered with WordPress.
- add_filter() : mixed
- Add a new filter to the collection to be registered with WordPress.
- run() : mixed
- Registers the filters and actions with WordPress.
- add() : array<string|int, mixed>
- A utility function that is used to register the actions and hooks into a single collection.
Properties
$actions
The array of actions registered with WordPress.
protected
array<string|int, mixed>
$actions
Tags
$filters
The array of filters registered with WordPress.
protected
array<string|int, mixed>
$filters
Tags
Methods
__construct()
Initialize the collections used to maintain the actions and filters.
public
__construct() : mixed
Tags
Return values
mixed —add_action()
Add a new action to the collection to be registered with WordPress.
public
add_action(string $hook, object $component, string $callback[, int $priority = 10 ][, int $accepted_args = 1 ]) : mixed
Parameters
- $hook : string
-
The name of the WordPress action that is being registered.
- $component : object
-
A reference to the instance of the object on which the action is defined.
- $callback : string
-
The name of the function definition on the
$component
. - $priority : int = 10
-
(optional) The priority at which the function should be fired. Default is 10.
- $accepted_args : int = 1
-
(optional) The number of arguments that should be passed to the $callback. Default is 1.
Tags
Return values
mixed —add_filter()
Add a new filter to the collection to be registered with WordPress.
public
add_filter(string $hook, object $component, string $callback[, int $priority = 10 ][, int $accepted_args = 1 ]) : mixed
Parameters
- $hook : string
-
The name of the WordPress filter that is being registered.
- $component : object
-
A reference to the instance of the object on which the filter is defined.
- $callback : string
-
The name of the function definition on the
$component
. - $priority : int = 10
-
(optional) The priority at which the function should be fired. Default is 10.
- $accepted_args : int = 1
-
(optional) The number of arguments that should be passed to the $callback. Default is 1.
Tags
Return values
mixed —run()
Registers the filters and actions with WordPress.
public
run() : mixed
Tags
Return values
mixed —add()
A utility function that is used to register the actions and hooks into a single collection.
private
add(array<string|int, mixed> $hooks, string $hook, object $component, string $callback, int $priority, int $accepted_args) : array<string|int, mixed>
Parameters
- $hooks : array<string|int, mixed>
-
The collection of hooks that is being registered (that is, actions or filters).
- $hook : string
-
The name of the WordPress filter that is being registered.
- $component : object
-
A reference to the instance of the object on which the filter is defined.
- $callback : string
-
The name of the function definition on the
$component
. - $priority : int
-
The priority at which the function should be fired.
- $accepted_args : int
-
The number of arguments that should be passed to the
$callback
.
Tags
Return values
array<string|int, mixed> —The collection of actions and filters registered with WordPress.