pre_insert_term
Filters a term before it is sanitized and inserted into the database.
Usage
add_filter( 'pre_insert_term', 'wp_kama_pre_insert_term_filter', 10, 2 ); /** * Function for `pre_insert_term` filter-hook. * * @param string|WP_Error $term The term name to add, or a WP_Error object if there's an error. * @param string $taxonomy Taxonomy slug. * * @return string|WP_Error */ function wp_kama_pre_insert_term_filter( $term, $taxonomy ){ // filter... return $term; }
- $term(string|WP_Error)
- The term name to add, or a WP_Error object if there's an error.
- $taxonomy(string)
- Taxonomy slug.
Changelog
Since 3.0.0 | Introduced. |
Where the hook is called
pre_insert_term
wp-includes/taxonomy.php 2353
$term = apply_filters( 'pre_insert_term', $term, $taxonomy );