Title: PHP Fatal error login_header() undefined &#8211; fix
Last modified: October 7, 2022

---

# PHP Fatal error login_header() undefined – fix

 *  Resolved [filatovdanyl](https://wordpress.org/support/users/filatovdanyl/)
 * (@filatovdanyl)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/)
 * Hi, I got a fatal error coming from your plugin:
 * `Call to undefined function WP2FA\\Authenticator\\login_header() in .../plugins/
   wp-2fa/includes/classes/Authenticator/class-login.php:813`
 * This error showed up in wp debug.log each time someone logged in and used 2fa.
 * Plugin version is latest at time of writing: 2.3.0.
 * I fixed it on my website with some code that I based on your code in login_html()
   function where you do check if login_header() function exists before calling 
   it and hooked it to your WP_2FA_PREFIX . ‘user_authenticated’ action which fires
   shortly before this error happens.
 * Code I added to my themes functions.php:
 *     ```
       add_action( 'init', 'wyf_2fa_error_fix_init' );
       function wyf_2fa_error_fix_init() {
       	if ( defined( 'WP_2FA_PREFIX' ) ) {
       		add_action( WP_2FA_PREFIX . 'user_authenticated', 'wyf_2fa_error_fix' );
       	}
       }
       function wyf_2fa_error_fix() {
       	if ( ( ( isset( $_REQUEST['interim-login'] ) ) ? filter_var( $_REQUEST['interim-login'], FILTER_VALIDATE_BOOLEAN ) : false ) && ! function_exists( 'login_header' ) && defined( 'WP_2FA_PATH' ) ) {
       		include_once WP_2FA_PATH . 'includes/functions/login-header.php';
       	}
       }
       ```
   
 * So pls fix this in your plugin too 🙂
    -  This topic was modified 3 years, 8 months ago by [filatovdanyl](https://wordpress.org/support/users/filatovdanyl/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/#post-16090132)
 * Hello [@filatovdanyl](https://wordpress.org/support/users/filatovdanyl/)
 * Thank you for using our plugin.
 * I am sorry to read about your issue. Just to confirm, this issue is happening
   with the interim login only, right?
 * Other users have already reported this problem and this is happening because 
   for some reason a function we are using (and which should be loaded at that time)
   is not found. Something third party, like a theme or another plugin is somehow
   interfering with this.
 * We have a build with a fix, in which we “enforce” the function. Can you please
   try update _20220923 WP2FA v2.3.0 – undefined function patch_ and let us know
   if it works for you?
 * You can [download it from our plugins patches page](https://www.wpwhitesecurity.com/support/plugins-patches/).
 * Looking forward to hearing from you.
 *  Thread Starter [filatovdanyl](https://wordpress.org/support/users/filatovdanyl/)
 * (@filatovdanyl)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/#post-16093676)
 * Hi [@robert681](https://wordpress.org/support/users/robert681/)
 * Installed your patch and removed my fix – works, no errors!
 * >  Just to confirm, this issue is happening with the interim login only, right?
 * – yes probably 🙂
 *  Plugin Contributor [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/#post-16108557)
 * I am glad to read that [@filatovdanyl](https://wordpress.org/support/users/filatovdanyl/)
 * Should there be anything else, do not hesitate to ask. By the way, please do 
   not forget to spare a minute to **[rate our plugin and service](https://wordpress.org/support/plugin/wp-2fa/reviews/)**.
   These really help us supporting the plugin.
 * Thank you and have a great day.
 *  [aryansapaad](https://wordpress.org/support/users/aryansapaad/)
 * (@aryansapaad)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/#post-16175759)
 * Hello [@robert681](https://wordpress.org/support/users/robert681/)
 * When will an official update roll in with this patch in it? I have done the fix
   for now, but today I got the same issue on a different website again. I guess
   it will be better if this patch fix comes in the next update of the plugin.
 *  Plugin Contributor [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/#post-16175788)
 * Hello [@aryansapaad](https://wordpress.org/support/users/aryansapaad/)
 * Thank you for using the plugin. We have already started working on the next update,
   and this patch will be included in the update. Even though I can’t give you an
   ETA of when this update will be available, I am pretty certain it will be ready
   before the festive season (and hopefully before!).
 * Thank you for your support and for using the plugin. Please do not forget to 
   spare a minute to [rate our plugin and service](https://wordpress.org/support/plugin/wp-2fa/reviews/).
   These ratings are really helpful, especially to maintain the free edition of 
   the plugin.
 * Have a great day.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Fatal error login_header() undefined – fix’ is closed to new replies.

 * ![](https://ps.w.org/wp-2fa/assets/icon-256x256.png?rev=2961533)
 * [WP 2FA - Two-factor authentication for WordPress](https://wordpress.org/plugins/wp-2fa/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-2fa/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-2fa/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-2fa/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-2fa/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-2fa/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [robertabela](https://wordpress.org/support/users/robert681/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/php-fatal-error-fix/#post-16175788)
 * Status: resolved