New answers tagged


If you're using wp_logout in your own code, its probably best to exit or wp_redirect immediately afterwards. You can call wp_set_current_user(0) after wp_logout() to manually log the user out instantly, if you need to continue executing PHP but don't want the user to be logged in.


This allows for the message to be overwritten specifically for the loggedout message while leaving all other messages alone. Here is more documentation on the filter. add_filter( 'wp_login_errors', 'my_logout_message' ); function my_logout_message( $errors ){ if ( isset( $errors->errors['loggedout'] ) ){ $errors->errors['loggedout'][0] = ...


Based on Sven's recommended solution and Tom J Nowell's warning about gettext() (see comments for both), I've fashioned the following solution: add_filter( 'login_message', 'wpse_215289_custom_logout_message' ); add_action( 'login_head','wpse_215289_custom_login_head' ); // Detect logout and add custom message. function wpse_215289_custom_logout_message() ...

Top 50 recent answers are included