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:
parent
6592e13cae
commit
a32a75b9f4
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue