xmlrpc_getpostcategory

The timeline below displays how wordpress function xmlrpc_getpostcategory has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves 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.
 *
 * @since 0.71
 *
 * @global string $post_default_category Default XML-RPC post category.
 *
 * @param string $content XMLRPC XML Request content
 * @return string|array List of categories or category name.
 */
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;
}

WordPress Version: 4.0

/**
 * 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.
 *
 * @since 0.71
 *
 * @global string $post_default_category Default XML-RPC post category.
 *
 * @param string $content XMLRPC XML Request content
 * @return string|array List of categories or category name.
 */
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;
}

WordPress Version: 3.9

/**
 * 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.
 *
 * @since 0.71
 *
 * @global string $post_default_category Default XMLRPC post category.
 *
 * @param string $content XMLRPC XML Request content
 * @return string|array List of categories or category name.
 */
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;
}

WordPress Version: 3.7

/**
 * 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.
 *
 * @package WordPress
 * @subpackage XMLRPC
 * @since 0.71
 *
 * @global string $post_default_category Default XMLRPC post category.
 *
 * @param string $content XMLRPC XML Request content
 * @return string|array List of categories or category name.
 */
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;
}