Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

POST_META not showing up #245

Closed
schmitzoide opened this issue May 28, 2014 · 8 comments
Closed

POST_META not showing up #245

schmitzoide opened this issue May 28, 2014 · 8 comments

Comments

@schmitzoide
Copy link

I've just updated to the last version and lost access to post_meta information (where I did access the custom fields for that post type) on the /posts&type=custom_type route. Even stranger, it sometimes appears, sometimes it doesn't. Any guess on what's going on?

@rmccue
Copy link
Member

rmccue commented May 29, 2014

In 1.0, custom meta changed to only being exposed on the edit context, as exposing it by default is a possible privacy issue. You'll also need to be authenticated to use this.

You can set the context to edit by adding &context=edit to your request.

@jeffsebring
Copy link

Do you plan to allow meta to be managed on post creation and edit, or is this a case for using a custom handler?

@rmccue
Copy link
Member

rmccue commented Jun 2, 2014

Do you plan to allow meta to be managed on post creation and edit, or is this a case for using a custom handler?

Should already be possible, using the same format as the standalone meta endpoints. :)

@jeffsebring
Copy link

Thank you! I was apparently doing_it_wrong.

@rachelbaker
Copy link
Member

@schmitzoide I am sorry for being slow to add more details to our post routes documentation surrounding how to view/edit post_meta fields. We you able to get this figured out?

We are using #213 to track adding the full post_meta details to our docs.

@schmitzoide
Copy link
Author

@rachelbaker What I did (still in early development stage) was commented out the part where it checks for permition ($this->check_edit_permission( $post )). I tried with Basic Authentication and context=edit as a parameter but it didn't work, still stating I cannot edit.

@rachelbaker
Copy link
Member

@schmitzoide For security and data integrity reasons there are several conditions that must be met for a post_meta key to be edited. We check that you can edit the post, that the meta field isn't protected, the meta value isn't an array, object or serialized.

https://github.com/WP-API/WP-API/blob/master/lib/class-wp-json-posts.php#L1011

Does that help?

@rmccue
Copy link
Member

rmccue commented Aug 22, 2014

Closing, not sure there are any issues left here to actually handle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants