Reset an action.
This function resets an action registered using beans_add_action() or beans_add_smart_action(). If the original values were replaced using beans_replace_action(), these values will be used.
beans_reset_action( string $id )
Return: (bool) Will always return true.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$id | string | true | - | The action ID. |
Source
function beans_reset_action( $id ) {
_beans_unset_action( $id, 'modified' );
_beans_unset_action( $id, 'removed' );
$action = _beans_get_action( $id, 'added' );
if ( $current = _beans_get_current_action( $id ) ) {
remove_action( $current['hook'], $current['callback'], $current['priority'], $current['args'] );
add_action( $action['hook'], $action['callback'], $action['priority'], $action['args'] );
}
return $action;
}