How can I check user capability when a page loads (via functions.php)?
If you want to redirect, a good event to use is template_redirect: add_action( ‘template_redirect’, ‘my_page_template_redirect’ ); function my_page_template_redirect() { // You can skip is_user_logged_in() if checking the user capability if( is_page( 1234 ) && ! current_user_can( ‘do_something_special’ ) ) { $redirect_to = ‘http://example.com/redirection-page’; // Default code status for redirection using wp_redirect is 302 // If … Read more