wp_update_term_parent filter-hookWP 3.1.0

Filters the term parent.

Hook to this filter to see if it will cause a hierarchy loop.

Usage

add_filter( 'wp_update_term_parent', 'wp_kama_update_term_parent_filter', 10, 5 );

/**
 * Function for `wp_update_term_parent` filter-hook.
 * 
 * @param int    $parent      ID of the parent term.
 * @param int    $term_id     Term ID.
 * @param string $taxonomy    Taxonomy slug.
 * @param array  $parsed_args An array of potentially altered update arguments for the given term.
 * @param array  $args        An array of update arguments for the given term.
 *
 * @return int
 */
function wp_kama_update_term_parent_filter( $parent, $term_id, $taxonomy, $parsed_args, $args ){

	// filter...
	return $parent;
}
$parent(int)
ID of the parent term.
$term_id(int)
Term ID.
$taxonomy(string)
Taxonomy slug.
$parsed_args(array)
An array of potentially altered update arguments for the given term.
$args(array)
An array of update arguments for the given term.

Changelog

Since 3.1.0 Introduced.

Where the hook is called

wp_update_term()
wp_update_term_parent
wp-includes/taxonomy.php 3210
$parent = (int) apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );

Where the hook is used in WordPress

wp-includes/default-filters.php 177
add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );