I'm looking for the simplest way to redirect a password protected page, to another page after entering the password.
E.g.
<?php if ( is_page('name-of-page') && ! post_password_required() ) {
wp_redirect( home_url() ); exit;
} ?>
Using wp_redirect is triggering a 'headers already sent error'.
I've seen some solutions using output buffering to avoid this but, I'm not sure if it is the best solution.
Thanks!
wp_redirect
in the middle of a template, it needs to be done before anything else is printed out