rest_insert_{$this->taxonomy}
Action HookDescription
Updates a single term from a taxonomy.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
View on GitHub
|
Hook Type | Action |
Line Number | 330 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_REST_Request
|
$request
|
Full details about the request. |
Usage Examples
Basic Usage
<?php
// Hook into rest_insert_{$this->taxonomy}
add_action('rest_insert_{$this->taxonomy}', 'my_custom_function', 10, 1);
function my_custom_function($request) {
// Your custom code here
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php:330
- How this hook is used in WordPress core
<?php
325 }
326
327 $term = get_term( $term->term_id, $this->taxonomy );
328
329 /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
330 do_action( "rest_insert_{$this->taxonomy}", $term, $request, false );
331
332 $schema = $this->get_item_schema();
333 if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) {
334 $meta_update = $this->meta->update_value( $request['meta'], $term->term_id );
335
PHP Documentation
<?php
/**
* Updates a single term from a taxonomy.
*
* @since 5.9.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
Related Hooks
Related hooks will be displayed here in future updates.