Make WordPress Core

Changeset 31019


Ignore:
Timestamp:
01/01/2015 07:54:53 PM (10 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r30983 r31019  
    413413 */
    414414function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
    415 
     415    global $wp_list_table;
    416416    /**
    417417     * Filter the in-line comment reply-to form output in the Comments
     
    436436    }
    437437
    438     if ( $mode == 'single' ) {
    439         $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
    440     } else {
    441         $wp_list_table = _get_list_table('WP_Comments_List_Table');
     438    if ( ! $wp_list_table ) {
     439        if ( $mode == 'single' ) {
     440            $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
     441        } else {
     442            $wp_list_table = _get_list_table('WP_Comments_List_Table');
     443        }
    442444    }
    443445
Note: See TracChangeset for help on using the changeset viewer.