Set beans_add_action() using the callback argument as the action ID.
This function is a shortcut of beans_add_action(). It does’t require an ID to be specified and uses the callback argument instead.
beans_add_smart_action( string $hook, callback $callback, int $priority = 10, int $args = 1 )
Return: (bool) Will always return true.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$hook | string | true | - | The name of the action to which the $callback is hooked. |
$callback | callback | true | - | The name of the function you wish to be called. Used to set the action ID. |
$priority | int | false | 10 | Used to specify the order in which the functions associated with a particular action are executed. Default 10. 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. |
$args | int | false | 1 | The number of arguments the function accept. Default 1. |
Source
function beans_add_smart_action( $hook, $callback, $priority = 10, $args = 1 ) {
return beans_add_action( $callback, $hook, $callback, $priority, $args );
}