WordPress.org

Make WordPress Core

Ticket #4115: xmlrpc.php.diff

File xmlrpc.php.diff, 688 bytes (added by redsweater, 7 years ago)

Patch to exclude empty categories from the getCategoryList function call.

  • xmlrpc.php

     
    15261526                $categories_struct = array(); 
    15271527 
    15281528                // FIXME: can we avoid using direct SQL there? 
    1529                 if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) { 
     1529                // Require category_count > 0 to match default category list displays in WordPress Web UI 
     1530                if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories WHERE category_count > 0", ARRAY_A)) { 
    15301531                        foreach ($cats as $cat) { 
    15311532                                $struct['categoryId'] = $cat['cat_ID']; 
    15321533                                $struct['categoryName'] = $cat['cat_name'];