Expose $post_id inside 'json_prepare_meta' filter in WP_JSON_Posts #67

Closed
unfulvio opened this Issue Jan 15, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@unfulvio

I need to alter the output of some custom fields in the json object.
This is easy with 'json_prepare_meta' filter:
https://github.com/WP-API/WP-API/blob/master/lib/class-wp-json-posts.php#L629

The problem that in order to do so I figured out I really need to know $post_id
Inside that filter I only have access to $custom_fields, which holds the result of get_post_meta() and that's it.

It would be nice if besides $custom_fields one could access also to $post_id while filtering the post meta, just like one can while filtering prepare_post function.

@unfulvio

This comment has been minimized.

Show comment Hide comment
@unfulvio

unfulvio Jan 22, 2014

i've realized I can filter json_prepare_post to achieve a similar purpose, but it would have been handy nevertheless to have the post ID in the other hook as well

i've realized I can filter json_prepare_post to achieve a similar purpose, but it would have been handy nevertheless to have the post ID in the other hook as well

@unfulvio unfulvio closed this Jan 22, 2014

@rmccue rmccue reopened this Feb 1, 2014

rmccue added a commit that referenced this issue Apr 15, 2014

@rmccue rmccue closed this in #137 Apr 15, 2014

kellbot pushed a commit to kellbot/WP-API that referenced this issue Aug 1, 2014

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