Skip to content

Commit

Permalink
PLANET-7216: Fix error on tag page (#2092)
Browse files Browse the repository at this point in the history
Ref: https://jira.greenpeace.org/browse/PLANET-7216

Fix instance of Post on tag page being WP_Post in some cases.
  • Loading branch information
lithrel authored Aug 8, 2023
1 parent 7c150a6 commit 0209cc9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0209cc9

Please sign in to comment.