Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_comment_query

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
264            * Filters arguments, before passing to WP_Comment_Query, when querying comments via the REST API.
265            *
266            * @since 4.7.0
267            *
268            * @link https://developer.wordpress.org/reference/classes/wp_comment_query/
269            *
270            * @param array           $prepared_args Array of arguments for WP_Comment_Query.
271            * @param WP_REST_Request $request       The current request.
272            */
273           $prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request );
274
275           $query        = new WP_Comment_Query;
276           $query_result = $query->query( $prepared_args );
277
278           $comments = array();
279
280           foreach ( $query_result as $comment ) {
281                if ( ! $this->check_read_permission( $comment, $request ) ) {
282                     continue;