Function
Determine if a TML action is being requested.
tml_is_action( string $action = '' )
Parameters
-
$actionstring Default'' - Optional. The action to check.
Return
bool
Is a TML action being requested?
Source
function tml_is_action( $action = '' ) {
$is_action = false;
$current_action = tml_get_action();
if ( $current_action && array_key_exists( $current_action->get_name(), tml_get_actions() ) ) {
if ( empty( $action ) ) {
$is_action = true;
} elseif ( $action === $current_action->get_name() ) {
$is_action = true;
}
}
/**
* Filter whether a TML action is being requested or not.
*
* @since 7.0
*
* @param bool $is_action Whether a TML action is being requested or not.
* @param string $action The action name.
*/
return apply_filters( 'tml_is_action', $is_action, $action );
}
Uses
Used by
Changelog
| Version | Description |
|---|---|
| 7.0 | Introduced. |