i have a page template thts sole purpose is to redirect to the url present in the customfield named extlink. but i keep getting the error "Warning: Cannot modify header information - headers already sent by (output started...." when i assign it to the post without assigning it working perfectly.
<?php
/**
* Template Name: change
**/
get_header();
?>
<?php
$redirect_url=get_field('extlink');
wp_redirect($redirect_url);
get_sidebar();
get_footer();
?>