Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_after_insert_{$this->taxonomy}

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
529            *  - `rest_after_insert_category`
530            *  - `rest_after_insert_post_tag`
531            *
532            * @since 5.0.0
533            *
534            * @param WP_Term         $term     Inserted or updated term object.
535            * @param WP_REST_Request $request  Request object.
536            * @param bool            $creating True when creating a term, false when updating.
537            */
538           do_action( "rest_after_insert_{$this->taxonomy}", $term, $request, true );
539
540           $response = $this->prepare_item_for_response( $term, $request );
541           $response = rest_ensure_response( $response );
542
543           $response->set_status( 201 );
544           $response->header( 'Location', rest_url( $this->namespace . '/' . $this->rest_base . '/' . $term->term_id ) );
545
546           return $response;
547      }
 
Line Code
634           $fields_update = $this->update_additional_fields_for_object( $term, $request );
635
636           if ( is_wp_error( $fields_update ) ) {
637                return $fields_update;
638           }
639
640           $request->set_param( 'context', 'edit' );
641
642           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
643           do_action( "rest_after_insert_{$this->taxonomy}", $term, $request, false );
644
645           $response = $this->prepare_item_for_response( $term, $request );
646
647           return rest_ensure_response( $response );
648      }
649
650      /**
651       * Checks if a request has access to delete the specified term.
652       *