From 0209cc94cbf38c93f5352b5d9f7e5e0eff3f57ab Mon Sep 17 00:00:00 2001 From: Florent Hernandez Date: Tue, 8 Aug 2023 11:14:58 +0200 Subject: [PATCH] PLANET-7216: Fix error on tag page (#2092) Ref: https://jira.greenpeace.org/browse/PLANET-7216 Fix instance of Post on tag page being WP_Post in some cases. --- tag.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag.php b/tag.php index 2ee1155e52..b2ebcce77a 100644 --- a/tag.php +++ b/tag.php @@ -40,6 +40,9 @@ $post = Timber::query_post(false, Post::class); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $context = Timber::get_context(); +if ($post instanceof \WP_Post) { + $post = new Post($post->ID); +} Context::set_og_meta_fields($context, $post); $context['tag'] = $tag;