Make WordPress Core

Ticket #56350: 56350.diff

File 56350.diff, 977 bytes (added by jimmyh61, 3 years ago)

Add exact search to REST API

  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index 2c9bf40..19c29bc 100644
    a b class WP_REST_Posts_Controller extends WP_REST_Controller { 
    251251                        'search'         => 's',
    252252                        'slug'           => 'post_name__in',
    253253                        'status'         => 'post_status',
     254                        'exact_search'   => 'exact',
    254255                );
    255256
    256257                /*
    class WP_REST_Posts_Controller extends WP_REST_Controller { 
    28332834                                'type'        => 'integer',
    28342835                        );
    28352836                }
     2837               
     2838                $query_params['exact_search'] = array(
     2839                        'description' => __( 'Use exact search instead of full search.' ),
     2840                        'type'        => 'boolean',
     2841                );
    28362842
    28372843                $query_params['offset'] = array(
    28382844                        'description' => __( 'Offset the result set by a specific number of items.' ),