XML-RPC metaWeblog.newPost . How to manage enclosures ?
-
Hi,
Does anybody knows how to manage enclosures with metaWeblog.newPost method https://codex.www.ads-software.com/XML-RPC_MetaWeblog_API.I take a look at the method implementation in : wp-includes/class-wp-xmlrpc-server.php and saw those interesting lines :
// Handle enclosures ... if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
Does any body know how to manage enclosure with this method ?
I tried this but definitevly doesn’t work, post is remotely created but not with enclosure :$content = array( 'title' => 'title', 'description' => 'description', 'mt_allow_comments' => 0, // 1 to allow comments 'mt_allow_pings' => 0, // 1 to allow trackbacks 'post_type' => 'post', 'mt_keywords' => '', 'categories' => array(''), 'enclosure' => array('url'=>'https://www.education.gov.yk.ca/pdf/pdf-test.pdf','length'=>'','type' =>'') ); $params = array(0,'admin','admin',$content,false); if (!$client->query('metaWeblog.newPost',$params)) { echo('Error occured while executing method : ' . $client->getErrorCode().":".$client->getErrorMessage()); } $response = $client->getResponse(); var_dump($response) ;
Greetings,
ben
- The topic ‘XML-RPC metaWeblog.newPost . How to manage enclosures ?’ is closed to new replies.