diff --git a/lib/full-site-editing/template-loader.php b/lib/full-site-editing/template-loader.php index f90f07c02fff55..c828a27c99a7bd 100644 --- a/lib/full-site-editing/template-loader.php +++ b/lib/full-site-editing/template-loader.php @@ -79,8 +79,16 @@ function gutenberg_override_query_template( $template, $type, array $templates = } if ( $current_template ) { - $_wp_current_template_content = empty( $current_template->content ) ? __( 'Empty template.', 'gutenberg' ) : $current_template->content; - + if ( empty( $current_template->content ) && is_user_logged_in() ) { + $_wp_current_template_content = + sprintf( + /* translators: %s: Template title */ + __( 'Empty template: %s', 'gutenberg' ), + $current_template->title + ); + } elseif ( ! empty( $current_template->content ) ) { + $_wp_current_template_content = $current_template->content; + } if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_success( $current_template ); } @@ -174,7 +182,10 @@ function gutenberg_get_the_template_html() { global $wp_embed; if ( ! $_wp_current_template_content ) { - return '

' . esc_html__( 'No matching template found', 'gutenberg' ) . '

'; + if ( is_user_logged_in() ) { + return '

' . esc_html__( 'No matching template found', 'gutenberg' ) . '

'; + } + return; } $content = $wp_embed->run_shortcode( $_wp_current_template_content );