[wp-testers] wp_newCategory in xmlrpc not working properly

Peter Westwood peter.westwood at ftwr.co.uk
Wed Dec 3 08:20:23 GMT 2008


grmark wrote:
> Hi all
>
> Anyone notice the wp_newCategory method is not working properly
> from xmlrpc.php file here is what args it accepts
>
>   
snip
> etc...
>
>
> Then I make request using this code
>
>   include ("xmlrpc.inc");
>   $blogURL=http://myblogurl.com/;
>   $xmlrpc_url=$blogURL."xmlrpc.php";
>   $client = new xmlrpc_client($xmlrpc_url);
>   $category="WordPress";
>   $params=array();
>   $params[] = new xmlrpcval("n/a");
>   $params[] = new xmlrpcval($username); 
>   $params[] = new xmlrpcval($password); 
>   $params[] = new xmlrpcval($category);
>   $msg    = new xmlrpcmsg("wp.newCategory",$params);
>   $client->accepted_compression=array();
>   $response = $client->send($msg);
>
> it returns new catgory ID but what I get in WordPress blog is a category name "W"
>
>   
snip
> I may do something wrong but please someone prove that I m doing wrong
>   
Your providing the wrong arguments to the API call.

It takes a struct for the category info from [1] the arguments are:

    * int blog_id
    * string username
    * string password
    * struct
          o string name
          o string slug
          o int parent_id
          o string description

[1] http://codex.wordpress.org/XML-RPC_wp#wp.newCategory

westi

-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5 



More information about the wp-testers mailing list