pfeifferNet

Loader
in package

Register all actions and filters 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
since
1.0.0
used-by
pLogin::__construct()

Table of Contents

Properties

$actions  : array<string|int, string|int>
The array of actions registered with WordPress.
$filters  : array<string|int, string|int>
The array of filters registered with WordPress.
$shortcodes  : array<string|int, string|int>
The array of shortcodes registered with WordPress.

Methods

__construct()  : void
Initialise the collections used to maintain the actions, filters and shortcodes.
add_action()  : void
Add a new action to the collection to be registered with WordPress.
add_filter()  : void
Add a new filter to the collection to be registered with WordPress.
add_shortcode()  : void
Add a new shortcode to the collection to be registered with WordPress
run()  : void
Register 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, string|int> $actions = array()

The actions registered with WordPress to fire when the plugin loads.

Tags
since
1.0.0

$filters

The array of filters registered with WordPress.

protected array<string|int, string|int> $filters = array()

The filters registered with WordPress to fire when the plugin loads.

Tags
since
1.0.0

$shortcodes

The array of shortcodes registered with WordPress.

protected array<string|int, string|int> $shortcodes = array()

The shortcodes to register with WordPress when the plugin loads.

Tags
since
1.0.0

Methods

__construct()

Initialise the collections used to maintain the actions, filters and shortcodes.

public __construct() : void
Tags
since
1.0.0

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 ]) : void
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
since
1.0.0

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 ]) : void
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
since
1.0.0

add_shortcode()

Add a new shortcode to the collection to be registered with WordPress

public add_shortcode(string $tag, object $component, string $callback[, int $priority = 10 ][, int $accepted_args = 2 ]) : void
Parameters
$tag : string

The name of the shortcode being registered.

$component : object

A reference to the instance of the object on which the shortcode is defined.

$callback : string

The name of the function that defines the shortcode.

$priority : int = 10

Optional. The priority at which the function should be fired. Default is 10.

$accepted_args : int = 2

Optional. The number of arguments that should be passed to the $callback. Default is 1.

Tags
since
1.0.0

run()

Register the filters and actions with WordPress.

public run() : void
Tags
since
1.0.0

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
since
1.0.0
Return values
array<string|int, mixed>

The collection of actions and filters registered with WordPress.


        
On this page

Search results