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
256           $fields_update = $this->update_additional_fields_for_object( $term, $request );
257
258           if ( is_wp_error( $fields_update ) ) {
259                return $fields_update;
260           }
261
262           $request->set_param( 'context', 'view' );
263
264           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
265           do_action( "rest_after_insert_{$this->taxonomy}", $term, $request, true );
266
267           $response = $this->prepare_item_for_response( $term, $request );
268           $response = rest_ensure_response( $response );
269
270           $response->set_status( 201 );
271           $response->header( 'Location', rest_url( $this->namespace . '/' . $this->rest_base . '/' . $term->term_id ) );
272
273           return $response;
274      }
 
Line Code
340           $fields_update = $this->update_additional_fields_for_object( $term, $request );
341
342           if ( is_wp_error( $fields_update ) ) {
343                return $fields_update;
344           }
345
346           $request->set_param( 'context', 'view' );
347
348           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
349           do_action( "rest_after_insert_{$this->taxonomy}", $term, $request, false );
350
351           $response = $this->prepare_item_for_response( $term, $request );
352
353           return rest_ensure_response( $response );
354      }
355
356      /**
357       * Deletes a single term from a taxonomy.
358       *