`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.

Built from https://develop.svn.wordpress.org/trunk@31019


git-svn-id: http://core.svn.wordpress.org/trunk@31000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-01 19:55:35 +00:00
parent a5593a64d3
commit 5e4941023b
2 changed files with 8 additions and 6 deletions

View File

@ -412,7 +412,7 @@ function get_inline_data($post) {
* @param bool $table_row * @param bool $table_row
*/ */
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) { 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 * Filter the in-line comment reply-to form output in the Comments
* list table. * list table.
@ -435,10 +435,12 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
return; return;
} }
if ( $mode == 'single' ) { if ( ! $wp_list_table ) {
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); if ( $mode == 'single' ) {
} else { $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
$wp_list_table = _get_list_table('WP_Comments_List_Table'); } else {
$wp_list_table = _get_list_table('WP_Comments_List_Table');
}
} }
?> ?>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31018'; $wp_version = '4.2-alpha-31019';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.