WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/edited $taxonomy

Description

The edit_$taxonomy action is used to hook into code after a custom taxonomy term is updated in the database.

A plugin (or theme) can register an action hook from the example below.

Parameters

$term_id
(int) (required) ID of the term about to be edited
Default: None
$taxonomy
(string) (required) Taxonomy slug of the related term
Default: None

Examples

Assuming you registered a custom taxonomy and stored the taxonomy slug as a variable called "$my_taxonomy_slug". You would also use this sample code within the class.

<?php 
add_action( 'edited_' . $my_taxonomy_slug, 'custom_term_slug_edit_success', 10, 2 );
/**
 * Custom redirect on taxonomy term update, keeps users on the term page for additional updates
 *
 * @param $term_id
 * @param $taxonomy
 */
function custom_term_slug_edit_success( $term_id, $taxonomy ) {
	wp_safe_redirect( admin_url( 'edit-tags.php?action=edit&taxonomy=' . $my_taxonomy_slug . '&tag_ID=' . $term_id . '&notice=success' ) );
	exit;
}
?>

See Also