[wp-trac] [WordPress Trac] #47194: Posts endpoint: Enable collection parameters for querying by custom field

WordPress Trac noreply at wordpress.org
Tue Jun 25 18:37:40 UTC 2019


#47194: Posts endpoint: Enable collection parameters for querying by custom field
--------------------------+------------------------------
 Reporter:  coreymckrill  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  rest-api
--------------------------+------------------------------
Changes (by TimothyBlynJacobs):

 * keywords:   => needs-patch


Comment:

 Using `register_meta` as a whitelist does seems like it'd be the way
 forward.

 Perhaps something like

 {{{#!php
 register_post_meta( 'post', '_my_meta_key', [
         'show_in_rest' => [
                 'allow_querying' => true,
         ],
 ] );
 }}}

 We'd need to decide how much customization we want to allow as well. For
 instance, I imagine the collection param schema would default to the
 existing schema. Do we want to allow customizing that schema as well? It'd
 allow for things like only allowing querying by certain values.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47194#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list