WordPress Child Theme Template auth_redirect wrapper
Try… function maybe_auth_redirect() { if ( is_page_template(‘my-template.php’) && ! is_user_logged_in() ) { auth_redirect(); } } add_action(‘template_redirect’, ‘maybe_auth_redirect’); https://developer.wordpress.org/reference/functions/is_page_template