• About WordPress
    • About WordPress
    • WordPress.org
    • Documentation
    • Support
    • Feedback
  • Log In
  • Register
WordPress.org
WordPress.org
  • Plugins
  • Themes
  • Patterns
  • Learn
  • Support
    • Documentation
    • Forums
  • News
  • About
  • Get Involved
    • Five for the Future
  • Showcase
  • Mobile
  • Hosting
  • Openverse
  • Get WordPress
Get WordPress

Code Reference

Skip to content
Filter by type:
Search
Browse: Home / Reference / Hooks / wp_login_errors

apply_filters( 'wp_login_errors', WP_Error $errors, string $redirect_to )

Filters the login page errors.

Contents

  • Parameters
  • Source
  • Changelog
  • User Contributed Notes

Parameters

$errors

(WP_Error) WP Error object.

$redirect_to

(string) Redirect destination URL.


Top ↑

Source

File: wp-login.php

View on Trac


Top ↑

Changelog

Changelog
Version Description
3.6.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
    Contributed by Muhammad Arslan — 12 months ago
    /**
     * Change the Register Success message 
     * @param WP_Error	$wp_error The WP_Error object.
     * @param string		Redirect destination URL.
     * 
     * @return WP_Error	$wp_error The WP_Error object.
     */
    add_filter( 'wp_login_errors', 'wpdocs_filter_wp_login_errors', 10, 2 );
    
    function wpdocs_filter_wp_login_errors( $errors, $redirect_to ) {
    	// Run Only if user registration is a success
    	if ( strpos( $_SERVER['REQUEST_URI'], 'checkemail=registered' ) !== false ) {
    
    		// Remove the existing Register success message
    		$errors->remove( 'registered' );
    
    		// make the changes to register message
    		$errors->add( 'registered', sprintf( __( 'Please check your Spam box if email is not to be found in inbox.' ), wp_login_url() ), 'message' );
    
    		return $errors;
    	} else {
    		// Return the other message and errors
    		return $errors;
    	}
    }

    Expand full source codeCollapse full source code

    Log in to add feedback

You must log in before being able to contribute a note or feedback.

  • About
  • News
  • Hosting
  • Donate
  • Support
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • Patterns
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
WordPress.org
WordPress.org
  • Visit our Facebook page
  • Visit our Twitter account
Code is Poetry

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.