From 9c509a1eaef7a6920ee9059e063cfaec3fae996a Mon Sep 17 00:00:00 2001 From: azaozz Date: Thu, 5 Jan 2017 01:52:06 +0000 Subject: [PATCH] Always add `page-template-default` class to the editor body when the template is not specified. This matches the behavior on the front-end. Props timph (for the detailed bug report), azaozz. Fixes #39368 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@39678 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-editor.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php index 916be4d9d4..1d2c75c113 100644 --- a/src/wp-includes/class-wp-editor.php +++ b/src/wp-includes/class-wp-editor.php @@ -681,8 +681,10 @@ final class _WP_Editors { $body_class .= ' post-format-standard'; } - if ( $page_template = get_page_template_slug( $post ) ) { - $page_template = str_replace( '.', '-', basename( $page_template, '.php' ) ); + $page_template = get_page_template_slug( $post ); + + if ( $page_template !== false ) { + $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) ); $body_class .= ' page-template-' . sanitize_html_class( $page_template ); } }