Support » Plugin: Simple Page Redirect » add condition is_singular()!!!

  • If you do not add the condition, the section pages or search results will also perform the redirection!

    function me_spr_permalink_redirect($permalink) {
        global $post;
    	if (is_singular() ){
    		$url = get_post_meta($post->ID,'me_spr_post_redirect',true);
    		if (!empty($url)) {
    			wp_redirect($url,301);
    			exit;
    		}
    	}
        return ;
    }
Viewing 1 replies (of 1 total)
  • Plugin Author imemine

    (@imemine)

    Hello Alberto,

    I looked into it, template_redirectis not loaded on a search page for the posts. What kind of sections do you mean?

    template_includedoes get loaded on searches though.

    Thanks

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.