From 6fbb7d9a075ab4613ec5ea18b11d74958ac2ff8e Mon Sep 17 00:00:00 2001 From: Joseph Scott Date: Wed, 12 Feb 2025 09:59:47 -0700 Subject: [PATCH 1/2] varia: check if get_the_tag_list() returned a string Calls to `get_the_tag_list()` can return `string|false|WP_Error` - https://developer.wordpress.org/reference/functions/get_the_tag_list/ - but the return value not fully checked. The only useful thing in the return value is when it is a string. If it is a `WP_Error` object then it results in a fatal error. --- varia/inc/template-tags.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/varia/inc/template-tags.php b/varia/inc/template-tags.php index 052b4895c3..c4949f4e27 100644 --- a/varia/inc/template-tags.php +++ b/varia/inc/template-tags.php @@ -97,7 +97,7 @@ function varia_entry_meta() { /* translators: used between list items, there is a space after the comma. */ $tags_list = get_the_tag_list( '', __( ', ', 'varia' ) ); - if ( $tags_list ) { + if ( is_string( $tags_list ) ) { printf( /* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */ '%1$s%2$s%3$s', From 890cffc82a0b85b827acabaf9eceae2919203524 Mon Sep 17 00:00:00 2001 From: Joseph Scott Date: Wed, 12 Feb 2025 10:46:39 -0700 Subject: [PATCH 2/2] varia: check if get_the_tag_list() returned a string, part 2 See also https://github.com/Automattic/themes/pull/8692 I missed this second one originally --- varia/inc/template-tags.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/varia/inc/template-tags.php b/varia/inc/template-tags.php index c4949f4e27..b1e3694715 100644 --- a/varia/inc/template-tags.php +++ b/varia/inc/template-tags.php @@ -162,7 +162,7 @@ function varia_entry_footer() { /* translators: used between list items, there is a space after the comma. */ $tags_list = get_the_tag_list( '', __( ', ', 'varia' ) ); - if ( $tags_list ) { + if ( is_string( $tags_list ) ) { printf( /* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */ '%1$s%2$s%3$s',