Create New Category on WordPress with wp.newCategory and IXR_Library

Still related to my previous article about the XMLRPC and IXR_LIbrary. This time I will discuss how to create a new category in wordpress via XMLRPC with wp.newCategory remote API. Who still did not fully understand IXR_Library and XMLRPC can read in my previous article Simple wordpress xmlrpc with IXR_Library Class.

How to create New Category on WordPress with wp.newCategory and IXR_Library

 How to use wp.newCategory 

According to source from, wordpress wp.newCategory is an API used to create a new category. The parameters used in the following

  • int blogid
  • string username
  • string password
  • struct category
    • string name
    • string description
    • int parent_id
    • string slug

We will get return value as category_id  after creating wordpress category.

Lets Begin tutorial

1. Download IXR_LIbrary here.

2. Create php file as category.php and copy code below

	include "IXR_Library.php";
	$XmlRpc_result = null;
	$url= '';
	$XmlRpc_client = new IXR_Client ($url);
	$content = array(
                 'description'=>'create new category with wp.newCategory and IXR_Library',
		 'parent_id' => 0,
	$params = array(1,'username','password',$content);
		$XmlRpc_result = $XmlRpc_client->query(
		$data = $XmlRpc_client->getResponse();
	 catch (Exception $e){
		 var_dump ( $e->getMessage ());

You can use looping statement to create many categories.

Thus tutorial of create new category on wordpress use wp.newCategory and IXR_Library, You can leave question in the comment box below. My other XMLRPC tutorial can be read here

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: