[wp-trac] [WordPress Trac] #46238: REST API: Allow conditional field registration

WordPress Trac noreply at wordpress.org
Sun Oct 25 12:43:09 UTC 2020


#46238: REST API: Allow conditional field registration
------------------------------------------+------------------------------
 Reporter:  dmsnell                       |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  REST API                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by dominic_ks):

 Cheers for commenting on this @TimothyBlynJacobs. Re: the two approaches
 you mentioned, to check I understand:

 Are you suggesting here that an extra param could be passed to
 `register_rest_field` that is then called to see if the field should be
 included or skipped for the current post? If so this could be relatively
 straight forward to add this and check it in
 `add_additional_fields_to_object`.

 There's mention here of the schema, do you think anything is required here
 to highlight that a particular field may not be included in a response?

 If I've understood correctly here I will prepare a patch and come back
 with it

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


More information about the wp-trac mailing list