Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_prepare_{$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

Line Code
131
132           $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
133           $data    = $this->add_additional_fields_to_object( $data, $request );
134           $data    = $this->filter_response_by_context( $data, $context );
135
136           $response = rest_ensure_response( $data );
137           $response->add_links( $this->prepare_links( $term ) );
138
139           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
140           return apply_filters( "rest_prepare_{$this->taxonomy}", $response, $term, $request );
141      }
142
143      /**
144       * Prepares links for the request.
145       *
146       * @since 5.9.0
147       *
148       * @param WP_Term $term Term object.
149       * @return array Links for the given term.