Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_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
231                     $term->add_data( array( 'status' => 400 ) );
232                }
233
234                return $term;
235           }
236
237           $term = $this->get_term( $term );
238
239           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
240           do_action( "rest_insert_{$this->taxonomy}", $term, $request, true );
241
242           $schema = $this->get_item_schema();
243           if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) {
244                $meta_update = $this->meta->update_value( $request['meta'], $term->term_id );
245
246                if ( is_wp_error( $meta_update ) ) {
247                     return $meta_update;
248                }
249           }
 
Line Code
315
316                if ( is_wp_error( $update ) ) {
317                     return $update;
318                }
319           }
320
321           $term = get_term( $term->term_id, $this->taxonomy );
322
323           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
324           do_action( "rest_insert_{$this->taxonomy}", $term, $request, false );
325
326           $schema = $this->get_item_schema();
327           if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) {
328                $meta_update = $this->meta->update_value( $request['meta'], $term->term_id );
329
330                if ( is_wp_error( $meta_update ) ) {
331                     return $meta_update;
332                }
333           }