From a32a75b9f461055820e904548c6da1a4a1f81156 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 11 Sep 2014 13:56:15 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-xmlrpc-server.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 4ea5df60f8..3a792c21bb 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -911,8 +911,10 @@ class wp_xmlrpc_server extends IXR_Server { // Pull the categories info together. $categories = array(); - foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) { - $categories[] = get_cat_name( $cat_id ); + 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.