WordPress XMLRPC: wp.getPageStatusList

WordPress XMLRPC provides wp.getPageStatusList to retrieve all of the WordPress supported page statuses.


  1. int blog_id
  2. string username
  3. string password

Return Values

  • struct
    1. const string ‘draft’
    2. const string ‘private’
    3. const string ‘publish’

Let’s see the program. Note that you must fill the following parameters

  3. $BLOGID

Note that BLOGID is usually one or you can use wp.getUsersBlogs to get the value of BLOGID.

$USERNAME = "admin";
$PASSWORD = "check";
$BLOGID = 1;
$BLOGURL = "http://localhost/wordpress";

$XMLRPC_URL = $BLOGURL."/xmlrpc.php";

function get_response($URL, $context) {
 if(!function_exists('curl_init')) {
 die ("Curl PHP package not installedn");
 /*Initializing CURL*/
 $curlHandle = curl_init();
 /*The URL to be downloaded is set*/
 curl_setopt($curlHandle, CURLOPT_URL, $URL);
 curl_setopt($curlHandle, CURLOPT_HEADER, false);
 curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
 curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $context);
 /*Now execute the CURL, download the URL specified*/
 $response = curl_exec($curlHandle);
 return $response;
  /*Creating the wp.getPageStatusList request */
  $request = xmlrpc_encode_request("wp.getPageStatusList",
  /*Making the request to wordpress XMLRPC of your blog*/
  $xmlresponse = get_response($XMLRPC_URL, $request);
  $response = xmlrpc_decode($xmlresponse);
  if ($response && xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
  } else {
    /*Printing the response on to the console*/
echo "n";

Let’s execute the program

$ php wp.getPageStatusList.php

The output will be something like
<?xml version="1.0"?>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s