theimben
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Fixing WordPress
In reply to: Add Custom Fields To A Post Using XML-RPCThank you 🙂
Forum: Fixing WordPress
In reply to: Add Custom Fields To A Post Using XML-RPCThat makes more sense but how would I put that in the function I have?
Forum: Plugins
In reply to: [Plugin: TDO Mini Forms] Title of postI’m looking how to do this too.
Forum: Fixing WordPress
In reply to: Add Custom Fields To A Post Using XML-RPCI can’t work out how to do this. This is what I’ve tried but it doesn’t work. It adds the post but not the custom fields.
function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1)){ $categories = implode(",", $categories); $XML = "<title>$title</title>". "<category>$categories</category>". $body; $cflds = array('name' => 'a name', 'url' => 'http://www.google.com'); $content = array('post_type' => 'post', 'title' => $title, 'description' => $body, 'custom_fields' => $cflds); $params = array('',$username,$password,$content,$XML,1); $request = xmlrpc_encode_request('metaWeblog.newPost',$params); $ch = curl_init(); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_URL, $rpcurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 1); curl_exec($ch); curl_close($ch); echo '<pre>'.$request; }
Viewing 4 replies - 1 through 4 (of 4 total)