wp_update_term_parent

Filters the term parent.

Description

apply_filters( 'wp_update_term_parent', (int) $args_parent, (int) $term_id, (string) $taxonomy, (array) $parsed_args, (array) $args ); 

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

Parameters (5)

0. $args_parent (int)
ID of the parent term.
1. $term_id (int)
The term id.
2. $taxonomy (string)
Taxonomy slug.
3. $parsed_args (array)
An array of potentially altered update arguments for the given term.
4. $args (array)
An array of update arguments for the given term.

Usage

To run the hook, copy the example below.
  1. $args_parent = apply_filters( 'wp_update_term_parent', $args_parent, $term_id, $taxonomy, $parsed_args, $args ); 
  2.  
  3. if ( !empty( $args_parent ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_update_term_parent callback 
  2. function filter_wp_update_term_parent( $args_parent, $term_id, $taxonomy, $parsed_args, $args ) { 
  3. // make filter magic happen here... 
  4. return $args_parent
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_update_term_parent', 'filter_wp_update_term_parent', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_update_term_parent', 'filter_wp_update_term_parent', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

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