Answers:
看看wp-includes/taxonomy.php
。这些动作是:
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 );
您正在寻找created_term
,edited_term
和delete_term
。每个回调都接受3个参数:
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 );