diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index c0f7e9add6..9a46d7e2f7 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -537,7 +537,7 @@ add_action( 'template_redirect', '_wp_admin_bar_init', 0 ); add_action( 'admin_init', '_wp_admin_bar_init' ); add_action( 'before_signup_header', '_wp_admin_bar_init' ); add_action( 'activate_header', '_wp_admin_bar_init' ); -add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); +add_action( 'wp_body_open', 'wp_admin_bar_render', 0 ); add_action( 'in_admin_header', 'wp_admin_bar_render', 0 ); // Former admin filters that can also be hooked on the front end. diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 54c7483089..40eb84342b 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2889,6 +2889,14 @@ function wp_head() { * @since 1.5.1 */ function wp_footer() { + /** + * Sets up the Admin Bar if the current theme does not use `wp_body_open`. + * + * @since 5.4.0 + */ + if ( ! did_action( 'wp_body_open' ) ) { + add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); + } /** * Prints scripts or data before the closing body tag on the front end. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 785d7c6107..3cc741ef40 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47220'; +$wp_version = '5.4-alpha-47221'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.