Skip to content

Commit

Permalink
Fix tag page when redirection is not set
Browse files Browse the repository at this point in the history
This is a revert of fc35da6

It seems that `get_post` returns a specific post even the argument passed as id
is an empty string.
  • Loading branch information
comzeradd committed Nov 13, 2024
1 parent f8eca14 commit dfc64e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit dfc64e4

Please sign in to comment.