From bb3325a6df70c908446244752da07b4d27dda947 Mon Sep 17 00:00:00 2001 From: scribu Date: Thu, 21 Oct 2010 15:30:35 +0000 Subject: [PATCH] Fix notices in WP_List_Table::ajax_response(). Props Utkarsh. Fixes #15185 git-svn-id: https://develop.svn.wordpress.org/trunk@15894 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/list-table.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/list-table.php b/wp-admin/includes/list-table.php index ffc771a9e7..5561fbdd31 100644 --- a/wp-admin/includes/list-table.php +++ b/wp-admin/includes/list-table.php @@ -782,11 +782,15 @@ class WP_List_Table { $this->display_rows(); $rows = ob_get_clean(); - die( json_encode( array( - 'rows' => $rows, - 'total_items' => sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ), - 'total_pages' => $total_pages - ) ) ); + $response = array( 'rows' => $rows ); + + if ( isset( $total_items ) ) + $response['total_items'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ); + + if ( isset( $total_pages ) ) + $response['total_pages'] = $total_pages; + + die( json_encode( $response ) ); } /**