1. Home
  2. Docs
  3. Rules Developer Guide
  4. Extending Rules

Extending Rules

Extending rules is done through code. All new events, conditions, or actions should be registered when the rules_register_ecas action is triggered:

function myplugin_rules_register_ecas() { 
    rules_describe_event( 'action', 'myplugin_action_hook', array( 
        'title' => 'My Plugin Action Hook', 
        'description' => 'This event occurs when my plugin takes action.', 
        'group' => 'My Plugin',

add_action( 'rules_register_ecas', 'myplugin_rules_register_ecas' );

When adding new ECA’s, just call the appropriate rules core function.

New Events

rules_describe_event( $type, $hook_name, $definition );
rules_describe_events( $events );

New Conditions

rules_register_condition( $condition_key, $definition );
rules_register_conditions( $conditions );

New Actions

rules_define_action( $action_key, $definition );
rules_define_actions( $actions );

Was this article helpful to you? Yes No

How can we help?