XML-RPC: Check if category support was added for pages before calling wp_get_post_categories() to avoid unnecessary query in wp.getPage.

props markoheijnen, nprasath002.
fixes #17920.
Built from https://develop.svn.wordpress.org/trunk@29731


git-svn-id: http://core.svn.wordpress.org/trunk@29505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-09-11 13:56:15 +00:00
parent 6592e13cae
commit a32a75b9f4

View File

@ -911,9 +911,11 @@ class wp_xmlrpc_server extends IXR_Server {
// Pull the categories info together.
$categories = array();
if ( is_object_in_taxonomy( 'page', 'category' ) ) {
foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) {
$categories[] = get_cat_name( $cat_id );
}
}
// Get the author info.
$author = get_userdata( $page->post_author );