Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So, i have a function in my template file functions.php which cache a search form that contain a custom taxonomie terms. I want to flush cache (or delete one cache group) when I add/delete/edit terms of a specific taxonomie.

Is it possible? maybe with do_action, but for which hook? thx

share|improve this question

2 Answers 2

Look at wp-includes/taxonomy.php. The actions are:

do_action( "create_term",       $term_id, $tt_id, $taxonomy );
do_action( "created_term",      $term_id, $tt_id, $taxonomy );
do_action( "edited_term",       $term_id, $tt_id, $taxonomy );
do_action( 'delete_term',       $term,    $tt_id, $taxonomy, $deleted_term );
do_action( "create_$taxonomy",  $term_id, $tt_id );
do_action( "created_$taxonomy", $term_id, $tt_id );
do_action( "edited_$taxonomy",  $term_id, $tt_id );
do_action( "delete_$taxonomy",  $term,    $tt_id, $deleted_term );
share|improve this answer

You are looking for created_term, edited_term and delete_term. Each callback accepts 3 parameters:

function wpse_created_term( $term_id, $tt_id, $taxonomy ) {
}    
function wpse_edited_term( $term_id, $tt_id, $taxonomy ) {
}    
function wpse_delete_term( $term_id, $tt_id, $taxonomy ) {
}    

add_action( 'created_term', 'wpse_created_term', 10, 3 );
add_action( 'edited_term', 'wpse_edited_term', 10, 3 );
add_action( 'delete_term', 'wpse_delete_term', 10, 3 );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.