wordpress-xmlrpc-client
wordpress-xmlrpc-client copied to clipboard
Fill custom field when creating a new post
Hello,
I have rewrite the newPost function to add a custom field, but it doesn't work. Any idea? Thanks
function newPost($title, $body, array $content = array()) { $default = array( 'post_type' => 'post', 'post_status' => 'publish', 'mykey' => 'myvalue', ); $content = array_merge($default, $content); $content['post_title'] = $title; $content['post_content'] = $body;
$content['custom_fields'] = array(
'mykey' => 'myvalue',
);
$params = array(1, $this->_username, $this->_password, $content);
return $this->_sendRequest('wp.newPost', $params);
}