From 64784baa95729b96ab121524eed7f39ce4323814 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 1 Jan 2015 19:54:53 +0000 Subject: [PATCH] `WP_List_Table`'s constructor registers an `'admin_footer'` callback when AJAX is enabled. As such, if you create multiple instances of the class, you get multiple JS blobs on the page when the callbacks fire. Extra instances get made when `wp_comment_reply()` invokes the class constructor without checking for the existing instance via the `$wp_list_table` global. We shall check the `$wp_list_table` global in `wp_comment_reply()`. Props sorich87. Fixes #17413. git-svn-id: https://develop.svn.wordpress.org/trunk@31019 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/template.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 4c8de2dabf..747c611fa0 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -412,7 +412,7 @@ function get_inline_data($post) { * @param bool $table_row */ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) { - + global $wp_list_table; /** * Filter the in-line comment reply-to form output in the Comments * list table. @@ -435,10 +435,12 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', return; } - if ( $mode == 'single' ) { - $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); - } else { - $wp_list_table = _get_list_table('WP_Comments_List_Table'); + if ( ! $wp_list_table ) { + if ( $mode == 'single' ) { + $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); + } else { + $wp_list_table = _get_list_table('WP_Comments_List_Table'); + } } ?>