Created
May 13, 2013 07:35
-
-
Save srockstyle/5566722 to your computer and use it in GitHub Desktop.
wp.deletePostとxml_encode_request使うことでWordPressの投稿を削除することは可能。ただカスタム投稿タイプを削除できないみたい。ここは要調査。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function deletePost($rpcurl,$username,$password,$post_id) | |
{ | |
// xmlrpc settings | |
$params = array(0,$username,$password,$post_id); | |
// run xmlrpc | |
$request = xmlrpc_encode_request('wp.deletePost', $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); | |
$results = curl_exec($ch); | |
curl_close($ch); | |
// testing | |
var_dump( $results); | |
return $results; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment