rest_pre_insert_post_tag filter-hookWP 4.7.0

Filters term data before inserting term via the REST API.

This is one of the variants of the dynamic hook rest_pre_insert_(taxonomy)

Usage

add_filter( 'rest_pre_insert_post_tag', 'wp_kama_rest_pre_insert_post_tag_filter', 10, 2 );

/**
 * Function for `rest_pre_insert_post_tag` filter-hook.
 * 
 * @param object          $prepared_term Term object.
 * @param WP_REST_Request $request       Request object.
 *
 * @return object
 */
function wp_kama_rest_pre_insert_post_tag_filter( $prepared_term, $request ){

	// filter...
	return $prepared_term;
}
$prepared_term(object)
Term object.
$request(WP_REST_Request)
Request object.

Changelog

Since 4.7.0 Introduced.

Where the hook is called

WP_REST_Terms_Controller::prepare_item_for_database()
rest_pre_insert_post_tag
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 803
return apply_filters( "rest_pre_insert_{$this->taxonomy}", $prepared_term, $request );

Where the hook is used in WordPress

Usage not found.