php - WordPress upload image and media via XMLRPC -


i want upload media , images wordpress site via xml-rpc used code pupose:

$filename = 'sample.jpg'; $mime = 'images/jpeg'; $data = file_get_contents($filename); var_dump($wpclient->uploadfile($filename, $mime, $data, false)); 

the file uploads media , output that:

array(13) {   ["attachment_id"]=>   string(4) "7430"   ["date_created_gmt"]=>   object(stdclass)#3 (3) {     ["scalar"]=>     string(17) "20160727t19:57:29"     ["xmlrpc_type"]=>     string(8) "datetime"     ["timestamp"]=>     int(1469649449)   }   ["parent"]=>   int(0)   ["link"]=>   string(56) "http://url.com/wp-content/uploads/2016/07/sample.jpg"   ["title"]=>   string(10) "sample.jpg"   ["caption"]=>   string(0) ""   ["description"]=>   string(0) ""   ["metadata"]=>   string(0) ""   ["type"]=>   string(11) "images/jpeg"   ["thumbnail"]=>   string(56) "http://url.com/wp-content/uploads/2016/07/sample.jpg"   ["id"]=>   string(4) "7430"   ["file"]=>   string(10) "sample.jpg"   ["url"]=>   string(56) "http://url.com/wp-content/uploads/2016/07/sample.jpg" } 

but uploaded file doesn't have title or description, how can submit such things that?

i found way myself, after uploading file, should edit post , modify metas


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -