WordPress.org

Make WordPress Core

Changeset 44482


Ignore:
Timestamp:
01/08/2019 09:44:06 PM (8 months ago)
Author:
desrosj
Message:

REST API: Introduce rest_post_search_query filter.

This filter allows the query arguments to be manipulated for a post search query in the REST API.

Props Chouby, swissspidy.
Fixes #45454.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php

    r43739 r44482  
    6969        }
    7070
     71        /**
     72         * Filters the query arguments for a search request.
     73         *
     74         * Enables adding extra arguments or setting defaults for a post search request.
     75         *
     76         * @since 5.1.0
     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 );
Note: See TracChangeset for help on using the changeset viewer.