Support » Plugin: Shortcode Redirect » Minor hack to remove seconds delay

  • danwolfe

    (@danwolfe)


    This is an edit I did that works really well, figured I’d share it here….

    – Wolfe
    http://www.danwolfe.me

    
    add_shortcode('redirect', 'scr_do_redirect');
    function scr_do_redirect($atts)
    {
    	ob_start();
    	$myURL = (isset($atts['url']) && !empty($atts['url']))?esc_url($atts['url']):"";
    	$mySEC = (isset($atts['sec']) && !empty($atts['sec']))?esc_attr($atts['sec']):"0";
    	if(!empty($myURL))
      {
     
     ?>
     <meta http-equiv="refresh" content="<?php echo $mySEC; ?>; url=<?php echo $myURL; ?>">
    		
    <?php 
    	
    		wp_redirect($myURL, 301,'Redirected by ' ) ;
     
    	}
    	return ob_get_clean();
    }
    
    ?>
    • This topic was modified 5 months ago by danwolfe. Reason: typo

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author cartpauj

    (@cartpauj)

    This may cause “headers already sent” errors if output has already started for the page.

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