Adding Filters & Actions
Inside your XXX_Plugin.php class file find the function addActionsAndFilters(). Make your calls to add_action and add_filter there.
The call signatures look like this:
add_action( $tag, $function_to_add, $priority, $accepted_args );
add_filter( $tag, $function_to_add, $priority, $accepted_args );
Create a function in your class to do the action or filter. Pass it to the add_action/add_filter using array(object, function-name) syntax. For example:
1 2 3 4 5 6 7 | public function addActionsAndFilters() { add_action('action_hook', array(&$this, 'doMyAction')); } public function doMyAction() { // do it } |
Can you explain what this might be used for. How to invoke the action? Use case?