I'm using wordpress.com's public REST API to retrieve custom posts from a Wordpress installation. The JSON that's being returned is missing all the custom fields, however. The fields are definitely there and working, because I can filter on them. For example this URL:


is successfully limiting based on the facebook custom field, but that field isn't present in the response. Judging by the criteria for including custom fields in this article:

If the user performing the request is unauthenicated, he or she will not be able to add, edit or delete any metadata; will be able to read any metadata for which the key doesn’t begin with _ but will not be able to read any metadata which begins with _ unless it is whitelisted.

the field should be appearing. Is there something I'm missing, or is this a bug?

  • wordpress.com customizations are off topic here. Please ask their support.
    – fuxia
    Commented Sep 13, 2013 at 9:17
  • Please excuse my ignorance because I know nothing about Wordpress - but this isn't anything to do with wordpress.com (bar using their public API) - the site in question is a private wordpress installation. To my knowledge nothing has been customised, beyond the post type which is custom. Is that what you're referring to?
    – Craig
    Commented Sep 15, 2013 at 19:17
  • Try making an authenticated request. Commented Apr 30, 2015 at 17:41

1 Answer 1


Try using the rest_api_allowed_public_metadata filter to whitelist the facebook custom field. It will then appear in the response:

add_filter( 'rest_api_allowed_public_metadata', 'jeherve_allow_fb_metadata' );
function jeherve_allow_fb_metadata() {
    // only run for REST API requests
    if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST )
        return $allowed_meta_keys;

    $allowed_meta_keys[] = 'facebook';

    return $allowed_meta_keys;
  • Thanks; I have similar code in place but it doesn't make any difference. I raised this with Jetpack support and they think it's a problem on their end, so I'm waiting to see what happens with that.
    – Craig
    Commented Sep 22, 2013 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.