Is there a way to use PHP header redirect within a plugin?

I’m trying to use php redirects rather than using javascript to speed up my app. I’ve tried adding the header redirect calls within an action under the init hook since it runs after WordPress has finished loading but before any headers are sent. nothing happens. below is an example:

function redirect()
{

    header("Location:http://www.website.com/");
    die('should have redirected by now!');
}

add_action('init', 'redirect');

Any thoughts on how I can do php redirects?

Read More

thanks

Related posts

Leave a Reply

1 comment