Skip to content

Commit

Permalink
Check for $post before adding admin body classes. This prevents a PHP…
Browse files Browse the repository at this point in the history
… warning on the widgets screen where there is no post.
  • Loading branch information
ramonjd committed Dec 31, 2024
1 parent 3d097c7 commit 5a96389
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion varia/inc/wpcom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down

0 comments on commit 5a96389

Please sign in to comment.