Make WordPress Core


Ignore:
Timestamp:
09/11/2014 01:55:56 PM (10 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r29464 r29731  
    912912        // Pull the categories info together.
    913913        $categories = array();
    914         foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) {
    915             $categories[] = get_cat_name( $cat_id );
     914        if ( is_object_in_taxonomy( 'page', 'category' ) ) {
     915            foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) {
     916                $categories[] = get_cat_name( $cat_id );
     917            }
    916918        }
    917919
Note: See TracChangeset for help on using the changeset viewer.