From dfc64e471b9904cc7572334928d04a74ae62d0f4 Mon Sep 17 00:00:00 2001 From: Nikos Roussos Date: Wed, 13 Nov 2024 15:42:47 +0200 Subject: [PATCH] Fix tag page when redirection is not set This is a revert of fc35da662402012b2d67ae0266ac5aac1321a49b It seems that `get_post` returns a specific post even the argument passed as id is an empty string. --- tag.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag.php b/tag.php index cc74cbc028..30b56973f7 100644 --- a/tag.php +++ b/tag.php @@ -21,10 +21,10 @@ $tag = get_queried_object(); $redirect_id = get_term_meta($tag->term_id, 'redirect_page', true); -$redirect_page = get_post($redirect_id); -if ($redirect_page) { +if ($redirect_id) { global $wp_query; + $redirect_page = get_post($redirect_id); $wp_query->queried_object = $redirect_page; $wp_query->queried_object_id = $redirect_page->ID;