From 2c6c58b475dc347e562e393b011519158be26885 Mon Sep 17 00:00:00 2001 From: Nick Diego Date: Fri, 21 Aug 2020 09:34:28 -0400 Subject: [PATCH] Improved the category output on posts When a post had no category assigned, the _s_entry_footer() function would still output "Posted on Uncategorized". This commit fixes that. --- inc/template-tags.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index a9a1f1b03e..c19fc8e9b4 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -61,7 +61,7 @@ function _s_entry_footer() { if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', '_s' ) ); - if ( $categories_list ) { + if ( $categories_list && has_category() ) { /* translators: 1: list of categories. */ printf( '' . esc_html__( 'Posted in %1$s', '_s' ) . '', $categories_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped }