Perl WordPress::XMLRPC categories not being set.
- by Jay
The following code works fine to upload a new post to a WordPress blog but for the life of me I can't seem to get the categories to be set.
The categories exist. I've tried all lower case, tried case-matching, tried the slug version. Nothing works. No matter how I try passing the categories, the post gets assigned only to the default category.
I've scoured the web to find other pieces of sample code and none mention the actual code semantics of how to assign post to certain categories using the WordPress::XMLRPC module.
use WordPress::XMLRPC;
my $o = WordPress::XMLRPC-new;
$o-username('username');
$o-password('password');
$o-proxy('http://blogdomain.com/xmlrpc.php');
$o-server() || die "$!";
my $hashref = {
'title' = 'Test New Post 999 555456782',
'categories' = ['Categorie1', 'Categorie2'],
'description' = '<pHere is the content</p',
'mt_keywords' = 'tag1, tag2, tag3',
'mt_allow_comments' = 1,
};
my $ID = $o-newPost($hashref, 1);