[wp-trac] [WordPress Trac] #62646: PHP Warning in REST API when post_type doesn't support post-formats, but a post-format filter is applied.

WordPress Trac noreply at wordpress.org
Thu Dec 5 04:55:00 UTC 2024


#62646: PHP Warning in REST API when post_type doesn't support post-formats, but a
post-format filter is applied.
--------------------------+------------------------------
 Reporter:  dd32          |       Owner:  peterwilsoncc
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  6.7
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by yogeshbhutkar):

 **I've updated the PR to reflect on the suggested changes with a new
 commit.**

 However, I was wondering, if a Post Type supports post-formats and if we
 make a GET Request to it:


 {{{
 GET: http://localhost:8889/wp-json/wp/v2/no-post-formats?format[]=json
 }}}

 Then this would return an error stating `rest_invalid_param`. But if we
 incorporate the above logic and repeat the request, assuming that post-
 formats are now not supported for the Post Type, it will pass through and
 return an empty array. Seems expected that the param `format` would be
 ignored altogether, but sounds a little inconsistent maybe?

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


More information about the wp-trac mailing list