xmlrpc wp.newPost doesn't store custom_fields (1 post)

  1. JacerOmri
    Posted 3 years ago #

    i've came across a problem today with wordpress, i'm trying to post articles to my wordpress blog using xmlrpc interface, with a custom post_type and custom_fields (both defined in my theme). What actually happens is that the article gets posted, but the custom fields are lost. I've been debugging for the last 5 hours:

    • get_post_custom($post->ID); returns nothing: custom fields are not there!
    • checked the database, there are no post_metas
    • I'm making my custom_fields correctly (key/value)

    I've done some more research and I discovered that at line 286 in class-wp-xmlrpc-server.php elseif ( current_user_can( 'add_post_meta', $post_id, wp_unslash( $meta['key'] ) ) ) { is the problem, I've changed it to else { and everything worked. Note that I'm posting on behalf of the admin user and never done any changes to the user.
    So the question is, am I doing something wrong here?

Topic Closed

This topic has been closed to new replies.

About this Topic