rest_pre_insert_category
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_category', 'wp_kama_rest_pre_insert_category_filter', 10, 2 ); /** * Function for `rest_pre_insert_category` filter-hook. * * @param object $prepared_term Term object. * @param WP_REST_Request $request Request object. * * @return object */ function wp_kama_rest_pre_insert_category_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-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 859
return apply_filters( "rest_pre_insert_{$this->taxonomy}", $prepared_term, $request );