[wp-trac] [WordPress Trac] #42209: register_taxonomy with a non-sequential array index of post_types causes /wp-json/wp/v2/taxonomies to return an object not an array
WordPress Trac
noreply at wordpress.org
Mon Oct 16 09:14:10 UTC 2017
#42209: register_taxonomy with a non-sequential array index of post_types causes
/wp-json/wp/v2/taxonomies to return an object not an array
--------------------------+------------------------------
Reporter: spectacula | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.8.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by spectacula):
The expected and documented output for that part of the REST API is an
array and Guttenberg fails because it assumes an array but is given an
object.
http://v2.wp-api.org/reference/taxonomies/#schema-types
So passing the post_types array through '''array_values()''' before it
gets to '''json_encode()''' would have the desired effect. Array keys
aren't needed within '''register_taxonomy()''' so anybody passing the
output of '''get_post_types()''' will also see this problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42209#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list