Preparing meta using get_post_meta #14

Merged
merged 4 commits into from Nov 5, 2013

Conversation

Projects
None yet
5 participants
Contributor

afurculita commented Nov 5, 2013

Maybe it's better to use get_post_meta instead has_meta, as this way we make use of the caching system. And i don't think the meta id is relevant in any way

Preparing meta using get_post_meta
Maybe it's better to use get_post_meta instead has_meta, as this way we make use of the caching system. And i don't think the meta id is relevant in any way
Contributor

pippinsplugins commented Nov 5, 2013

👍 to this.

lib/class-wp-json-posts.php
@@ -575,7 +575,7 @@ protected function prepare_post( $post, $context = 'view' ) {
return new WP_Error( 'json_cannot_edit', __( 'Sorry, you cannot edit this post' ), array( 'status' => 403 ) );
// Post meta
- $_post['post_meta'] = $this->prepare_meta( $post['ID'] );
+ $_post['post_meta'] = $this->ta( $post['ID'] );
@kadamwhite

kadamwhite Nov 5, 2013

Contributor

Looks like truncating prepare_meta wasn't intentional

@afurculita

afurculita Nov 5, 2013

Contributor

Thanks, now i figured out what i'm doing wrong :D. I will be careful next time

Contributor

pippinsplugins commented Nov 5, 2013

Looks good to me now.

Japh added a commit that referenced this pull request Nov 5, 2013

Merge pull request #14 from afurculita/patch-1
Preparing meta using get_post_meta

@Japh Japh merged commit 4fd9646 into WP-API:master Nov 5, 2013

Owner

rmccue commented Nov 6, 2013

Correct me if I'm wrong, but this changes the returned value, correct? If so, we need to change the definition of the Metadata entity in the schema too.

Contributor

Japh commented Nov 6, 2013

My bad! Yes, this changes the returned value, so the schema needs updating too.

@ghost ghost assigned Japh Nov 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment