Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#42399 closed defect (bug) (wontfix)

$error variable in login action is probably undefined all the time

Reported by: nextendweb Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: Login and Registration Keywords:
Focuses: Cc:


In wp-login.php in the following code, the $error variable probably always evaluated as false as there is no global $error; anywhere. Is the code ok or it does not required anymore?

 * Filters whether to print the call to `wp_attempt_focus()` on the login screen.
 * @since 4.8.0
 * @param bool $print Whether to print the function call. Default true.
if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) { ?>
<?php } ?>

Change History (1)

#1 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Hi @nextendweb, thanks for the ticket!

The $error global used to be set in the wp_login() pluggable function, which is unused since [6643] and was formally deprecated in [13093].

The check in question was left for backward compatibility. The global is also checked in login_header().

A brief search in the Plugin Directory shows that some plugins still use the global, so I guess it's better to leave it as is for the time being.

Note: See TracTickets for help on using tickets.