I need to use PHP headers like header( 'Location: http://location.com' ); or header("Content-disposition: attachment; filename=$fileName"); from my wordpress plugin but it won't seem to how. I know that they need to be used before the page header is called, so I tried using the init hook:
add_action('init', 'test');
function test() {
header( 'Location: http://location.com' ) ;
}
but it didn't work.