Adding postmeta default values after adding post

I am using WordPress XMLRPC to add posts to my blog.

However, after running this.

Read More
$data = array(
            'title'   => $title,
            'description' => $content,
            'post_type'  => 'post',
            'categories'  => array($category),
            'post_status' => 'publish'
        );

            $addedPostReturn = $this->_client->query('metaWeblog.newPost',      
                                    array(0,$username,$password,$data,1));

This adds the post fine but doesn’t add the postmeta information.

If i open the post, click Update, all the default postmeta gets updated. However, I would like to add all the default postmeta information with my php script instead of manually (or else it kinda defeats the purpose).

Is there anyway, either with xmlrpc or regular wordpress functions to create the postmeta custom fields by using their default values? If not, is there a way to have the list of all the custom fields i need to manually add using the custom fields section of the metaWeblog.newPost function? (I don’t want to add some but not others. I rather do a complete job)

Thanks in advance… any help is appreciated! 🙂

EDIT:

$postUpdateContent = array();
$postUpdateContent['ID'] = $newPostId;
$postUpdateContent['post_content'] = $sameContent;
wp_update_post( $postUpdateContent );

didn’t seem to do the trick…

Related posts

Leave a Reply