has_action

Description

Checks if a particular action has been registered for a hook.

Usage

<?php $app->hook->has_action($hook, $function_to_check); ?>

Parameters

$hook: (string) (required) The name of the action to which $function_to_add is hooked. (See Action Reference for a list of action hooks).

$function_to_check: (callback) (optional) If specified, return the priority of the function on the hook or false if not attached.

Return Values

(int|bool) Returns the priority of a hook for a specified function.

Example

function check_if_action_exists($sacd)
{
    $app = \Liten\Liten::getInstance();
    
    if($app->hook->has_action('post_rgn_data')) {
        return true;
    }
}

Notes

$app->hook->has_action() is an alias of $app->hook->has_filter().

Change Log

Since 1.0.0

Source File

$app->hook->has_action() is located in app/src/Hooks.php.