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
134           $data    = $this->filter_response_by_context( $data, $context );
135
136           $response = rest_ensure_response( $data );
137
138           if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
139                $response->add_links( $this->prepare_links( $term ) );
140           }
141
142           /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
143           return apply_filters( "rest_prepare_{$this->taxonomy}", $response, $term, $request );
144      }
145
146      /**
147       * Prepares links for the request.
148       *
149       * @since 5.9.0
150       *
151       * @param WP_Term $term Term object.
152       * @return array Links for the given term.