WordPress.org

Make WordPress Core

Ticket #45454: 45454.2.diff

File 45454.2.diff, 1000 bytes (added by swissspidy, 2 years ago)
  • src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php

    diff --git src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
    index 804be3b31b..7205c18e88 100644
    class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler { 
    6868                        $query_args['s'] = $request['search'];
    6969                }
    7070
     71                /**
     72                 * Filters the query arguments for a request.
     73                 *
     74                 * Enables adding extra arguments or setting defaults for a post search request.
     75                 *
     76                 * @since 5.0.3
     77                 *
     78                 * @param array           $query_args Key value array of query var to query value.
     79                 * @param WP_REST_Request $request    The request used.
     80                 */
     81                $query_args = apply_filters( 'rest_post_search_query', $query_args, $request );
     82
    7183                $query     = new WP_Query();
    7284                $found_ids = $query->query( $query_args );
    7385                $total     = $query->found_posts;