WordPress.org

Make WordPress Core

Ticket #47053: 47053.6.diff

File 47053.6.diff, 1.7 KB (added by SergeyBiryukov, 19 months ago)
  • src/wp-includes/admin-bar.php

     
    7474                return;
    7575        }
    7676
     77        // Return early if the admin bar was already rendered on `wp_body_open`.
     78        if ( did_action( 'wp_body_open' ) && 'wp_body_open' !== current_action() ) {
     79                return;
     80        }
     81
    7782        /**
    7883         * Load all necessary admin bar items.
    7984         *
  • src/wp-includes/default-filters.php

     
    538538add_action( 'before_signup_header', '_wp_admin_bar_init' );
    539539add_action( 'activate_header', '_wp_admin_bar_init' );
    540540add_action( 'wp_body_open', 'wp_admin_bar_render', 0 );
     541add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); // Back-compat for themes not using `wp_body_open`.
    541542add_action( 'in_admin_header', 'wp_admin_bar_render', 0 );
    542543
    543544// Former admin filters that can also be hooked on the front end.
  • src/wp-includes/general-template.php

     
    28932893 */
    28942894function wp_footer() {
    28952895        /**
    2896          * Sets up the Admin Bar if the current theme does not use `wp_body_open`.
    2897          *
    2898          * @since 5.4.0
    2899          */
    2900         if ( ! did_action( 'wp_body_open' ) ) {
    2901                 add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
    2902         }
    2903         /**
    29042896         * Prints scripts or data before the closing body tag on the front end.
    29052897         *
    29062898         * @since 1.5.1