Make WordPress Core


Ignore:
Timestamp:
10/21/2010 03:30:35 PM (14 years ago)
Author:
scribu
Message:

Fix notices in WP_List_Table::ajax_response(). Props Utkarsh. Fixes #15185

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/list-table.php

    r15893 r15894  
    783783        $rows = ob_get_clean();
    784784
    785         die( json_encode( array(
    786             'rows' => $rows,
    787             'total_items' => sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ),
    788             'total_pages' => $total_pages
    789         ) ) );
     785        $response = array( 'rows' => $rows );
     786
     787        if ( isset( $total_items ) )
     788            $response['total_items'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
     789
     790        if ( isset( $total_pages ) )
     791            $response['total_pages'] = $total_pages;
     792
     793        die( json_encode( $response ) );
    790794    }
    791795
Note: See TracChangeset for help on using the changeset viewer.