[wp-trac] [WordPress Trac] #40904: Cannot display meta value in REST API
WordPress Trac
noreply at wordpress.org
Thu Jun 1 20:37:22 UTC 2017
#40904: Cannot display meta value in REST API
--------------------------+-----------------------------
Reporter: conner_bw | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.7.5
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Steps to reproduce:
{{{#!php
add_action( 'init', function() {
register_meta( 'post', 'zigzag', [ 'show_in_rest' => true ] );
} );
}}}
In WordPress multi-site, edit an existing post and add a a custom value
for key name 'zigzag', save the post.
Go to: http://DOMAIN/SITE/wp-json/wp/v2/posts/ID
Expected: meta node has a value for zigzag
Actual: zigzag is empty.
Reference: scroll down to "Working with Meta"
https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-
responses/
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40904>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list