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_term 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        Arguments passed to wp_update_term().
 *
 * @return int
 */
function wp_kama_update_term_parent_filter( $parent_term, $term_id, $taxonomy, $parsed_args, $args ){

	// filter...
	return $parent_term;
}
$parent_term(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)
Arguments passed to wp_update_term().

Changelog

Since 3.1.0 Introduced.

Where the hook is called

wp_update_term()
wp_update_term_parent
wp-includes/taxonomy.php 3294
$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 185
add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );