ZHXCore CMS

Actions


Based on Wordpress hook functions.

Add Action

Hooks a function on to a specific action.

Actions are the hooks that are launched at specific points during execution, or when specific events occur. Plugins can specify that one or more of its PHP functions are executed at these points, using the Action API.

add_action( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

Parameters
Required Type Name Description Default Value
Yes String $tag The name of the action to which the $function_to_add is hooked. --/--
Yes Callable $function_to_add The name of the function you wish to be called. --/--
No Int $priority Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. 10
No Int $arguments The number of arguments the function accepts. 1

Do Action

Execute functions hooked on a specific action hook.

This function invokes all functions attached to action hook $tag. It is possible to create new action hooks by simply calling this function, specifying the name of the new hook using the $tag parameter.

do_action( string $tag, $arg = '' )

Parameters
Required Type Name Description Default Value
Yes String $tag The name of the action to be executed. --/--
No Mixed $arg Additional arguments which are passed on to the functions hooked to the action. Empty

Additional Resources

You can find additional information on these function as they work in the same manner wordpress.