On this page
xmlrpc_getpostcategory( string $content ): string|array
Retrieves the post category or categories from XMLRPC XML.
Description
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.
Parameters
$contentstring Required-
XMLRPC XML Request content
Return
string|array List of categories or category name.
Source
File: wp-includes/functions.php. View all references
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;
}
Related
Used By
| Used By | Description |
|---|---|
| wp_xmlrpc_server::blogger_newPost() wp-includes/class-wp-xmlrpc-server.php | Creates new post. |
| wp_xmlrpc_server::blogger_editPost() wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
Changelog
| Version | Description |
|---|---|
| 0.71 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/xmlrpc_getpostcategory