I am trying to get the value of two post meta fields using wp.getPost.

I can get custom fields and the normal post fields but I can't seem to get the meta values associated with the post.

I have some custom postMeta that I have put in place called "_swmc_no_comment" and I want to be able to get the value of that. The codex isn't 100% clear on this, or at least my reading of it is poor and all experiments I try seem to fail

Can anyone give me any pointers on getting the post meta of a post via xml-rpc?

Cheers Dan

1 Answer 1


the filter xmlrpc_default_post_fields can modify the defult fields sent in rpc, but the defults array( 'post', 'terms', 'custom_fields' ) alredy include custom_fields

you also have the filter xmlrpc_prepare_post, where you can add extra stuff to the rpc:s post

  • Hmm custom_fields only returns custom fields though. What I want is meta, that I have added via a server side plugin. add_post_meta($post->ID, '_swmc_no_comment', 'redrafted', true) or
    – Dan
    Aug 14, 2013 at 5:26
  • codex.wordpress.org/Function_Reference/add_post_meta says "Adds a custom field (also called meta-data) to a specified post", so for me it looks like meta and custom_fields are the same, whats the difference between them in your point of view?
    – Puggan Se
    Aug 14, 2013 at 5:31
  • The difference simply that XML-RPC comes up as having no custom_fields in the response, i.e. [custom_fields] => Array ( ) however when I pull the meta on wordpress through get_post_meta($post_id, '_swmc_no_comment', true); I get the value "on" or off depending on the post
    – Dan
    Aug 14, 2013 at 5:42
  • Until I find a way I have worked around it in my scripts on the RPC client side and ping backs send a flag in the URL so this will work until I find a solution to get meta
    – Dan
    Aug 14, 2013 at 6:06

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.