function xmlrpc_getpostcategory( $content ) {}

Retrieve the post category or categories from XMLRPC XML.
If the category element is not found, then the default post category will be used. The return type then would be what $post_default_category. If the category is found, then it will always be an array.


  • string $content: XMLRPC XML Request content

Return values

returns:List of categories or category name.

Source code

function xmlrpc_getpostcategory( $content ) {

	global $post_default_category;

	if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {

		$post_category = trim( $matchcat[1], ',' );

		$post_category = explode( ',', $post_category );

	} else {

		$post_category = $post_default_category;


	return $post_category;



No comments yet... Be the first to leave a reply!

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: