wordpress filter reference

 

wordpress filter functions:
has_filter()
add_filter()
apply_filters()
apply_filters_ref_array()
current_filter()
remove_filter()
remove_all_filters()
doing_filter()

wordpress actions functions:

has_action()
add_action()
do_action()
do_action_ref_array()
did_action()
remove_action()
remove_all_actions()
doing_action()

function for activation hook

register_activation_hook()

function for uninstall hook

register_uninstall_hook()

function for deactivation hook

register_deactivation_hook()

how to add action in wordpress plugin:

first create php function:

function email_friend($post_ID)  {
$friend = ‘jon@example.org;
mail($friend, “i have come”, ‘everything is ok there !’);
return $post_ID;
}

add action step in wordpress plugin:

class emailer {
static function send($post_ID)  {
$friend = ‘jon@example.org;
mail($friend,”everything is ok there !’);
return $post_ID;
}
}

add_action(‘publish_post’, array(’emailer’, ‘send’));

if you want dynamic instance class for email then code would be :

class emailer {
static function send($post_ID)  {
$friend = ‘jon@example.org;
mail($friend,”everything is ok there !’);
return $post_ID;
}
}
$dynamicEmailClass = new emailer();
add_action(‘publish_post’, array(‘$dynamicEmailClass’, ‘send’));

 

 

adding action to wordpress is object oriented base and you would get a lot easier with other wordpress filters,hooks,functions ,APIs and more !

 

wordpress tutorials