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
This commit is contained in:
Scott Taylor 2015-01-01 19:54:53 +00:00
parent 186a94fb78
commit 64784baa95

View File

@ -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,11 +435,13 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
return;
}
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');
}
}
?>
<form method="get" action="">