Expectation:
I want to hide the login message that shows up on the Wordpress login form after a user has logged out. Added screenshot of the message that I am trying to hide.
Wordpress Version 5.4.2
Wordpres theme: Oceanwp 1.8.9
I have used the below mentioned code in the functions.php file of my theme.
add_filter( 'wp_login_errors', 'my_logout_message' );
function my_logout_message( $errors ){
if ( isset( $errors->errors['loggedout'] ) ){
return null;
}
return $errors;
}
Error Recieved:
I have provided the screen shot of the error that I have recieved.
https://i.imgur.com/xlpGiwM.png
Also, the login form isn't visible after user logout.
$errors->errors['loggedout']not returnnullby returningnullyou are removing the entire$errorsobject from the response which causes this error when later code that expects it to be there tries to call methods on it - Wesley Smith