posts)){ $pid = get_query_var('p'); $permalink = html_entity_decode(get_permalink($pid)); if($permalink){ wp_redirect($permalink, 301); exit; } } }