[wp-trac] [WordPress Trac] #39293: WordPress REST API warnings

WordPress Trac noreply at wordpress.org
Fri Dec 16 17:36:37 UTC 2016


#39293: WordPress REST API warnings
--------------------------+------------------------------
 Reporter:  dreamon11     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  4.7
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  rest-api
--------------------------+------------------------------
Changes (by jnylen0):

 * keywords:   => needs-patch


Comment:

 It's valid to call `add_theme_support( 'post-formats' )` with no
 additional arguments
 ([https://developer.wordpress.org/reference/functions/add_theme_support
 /#post-formats docs]), though I'm not sure how useful that is.

 Per the
 [https://codex.wordpress.org/Function_Reference/get_theme_support#Return
 `get_theme_support` documentation] the function will return `true` in this
 situation (and it could also return `false` in other situations).  So we
 should add `is_array` checks for both `$supports_formats` and
 `$supports_formats[0]` [https://github.com/WordPress/wordpress-
 develop/blob/4.7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-
 controller.php#L1921 here].

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


More information about the wp-trac mailing list