From 5a963899ad5f72877d0c28f3cbd2280bdd1f4041 Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 31 Dec 2024 13:49:11 +1100 Subject: [PATCH] Check for $post before adding admin body classes. This prevents a PHP warning on the widgets screen where there is no post. --- varia/inc/wpcom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/varia/inc/wpcom.php b/varia/inc/wpcom.php index bba1e0e79d..0e2e0e3687 100644 --- a/varia/inc/wpcom.php +++ b/varia/inc/wpcom.php @@ -147,7 +147,7 @@ function varia_wpcom_admin_body_classes( $classes ) { $hide = get_theme_mod( 'hide_front_page_title', false ); $front_page = (int) get_option( 'page_on_front' ); - if ( $is_block_editor_screen && $front_page === $post->ID && true === $hide ) { + if ( $is_block_editor_screen && ! empty( $post ) && $front_page === $post->ID && true === $hide ) { $classes .= ' hide-homepage-title'; }