How perform action during add/edit/delete category using hooks : wordpress


Hello Friends!!

If you want perform any action during add/edit/delete category/taxonomy without changing in wordpress core files then you can do it using wordpress hooks . You will only need to add given blow function in your theme function file, no need to edit

/** Call function during create new category/taxonomy */
add_action('create_term','wp_custom_save_taxonomy');
function wp_custom_save_taxonomy($term_id) {
print_r($_POST); // add action here
}
/** Call function during edit category/taxonomy */
add_action('edit_term','wp_custom_edit_taxonomy');
function wp_custom_edit_taxonomy($term_id) {
print_r($_POST); // add action here
}
/** Call function during delete category/taxonomy */
add_action('delete_term_taxonomy','wp_custom_delete_taxonomy');
function wp_custom_delete_taxonomy($term_taxonomy_id) {
       global $wpdb; // add action here
}

I hope you will enjoy wordpress hooks magic!!

Advertisements

Sr. Software Engineer

Tagged with: , , ,
Posted in Wordpress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: