WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 428 | * |
| 429 | * The dynamic portion of the hook name, `$this->taxonomy`, refers to the taxonomy slug. |
| 430 | * |
| 431 | * @since 4.7.0 |
| 432 | * |
| 433 | * @param WP_Term $term Inserted or updated term object. |
| 434 | * @param WP_REST_Request $request Request object. |
| 435 | * @param bool $creating True when creating a term, false when updating. |
| 436 | */ |
| 437 | do_action( "rest_insert_{$this->taxonomy}", $term, $request, true ); |
| 438 | |
| 439 | $schema = $this->get_item_schema(); |
| 440 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
| 441 | $meta_update = $this->meta->update_value( $request['meta'], (int) $request['id'] ); |
| 442 | |
| 443 | if ( is_wp_error( $meta_update ) ) { |
| 444 | return $meta_update; |
| 445 | } |
| 446 | } |
| Line | Code |
| 517 | |
| 518 | if ( is_wp_error( $update ) ) { |
| 519 | return $update; |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | $term = get_term( $term->term_id, $this->taxonomy ); |
| 524 | |
| 525 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */ |
| 526 | do_action( "rest_insert_{$this->taxonomy}", $term, $request, false ); |
| 527 | |
| 528 | $schema = $this->get_item_schema(); |
| 529 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
| 530 | $meta_update = $this->meta->update_value( $request['meta'], $term->term_id ); |
| 531 | |
| 532 | if ( is_wp_error( $meta_update ) ) { |
| 533 | return $meta_update; |
| 534 | } |
| 535 | } |