Username with quote can't login

Home Forums WordPress Plugins Support Login with Username or Email Username with quote can't login

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #1176
    Cristian Romanello

    Hi 🙂 Could I ask you an advice please?

    I need to permit users to login (also) with their stardard username, but that it could include a single quote. Currently I’ve added a custom filter that permits them to register with this special character in the username, but currently they aren’t able to login with their username, but only with the email.

    function custom_sanitize_user( $username, $strict = false ) {
    $username = wp_strip_all_tags( $username );
    //$username = remove_accents( $username );
    // Kill octets
    $username = preg_replace( ‘|%([a-fA-F0-9][a-fA-F0-9])|’, ”, $username );
    $username = preg_replace( ‘/&.+?;/’, ”, $username ); // Kill entities

    // If strict, reduce to ASCII for max portability.
    //if ( $strict )
    // $username = preg_replace( ‘|[^a-z0-9 _.\-@]|i’, ”, $username );

    $username = trim( $username );
    // Consolidate contiguous whitespace
    $username = preg_replace( ‘|\s+|’, ‘ ‘, $username );

    return $username;
    add_filter(‘sanitize_user’, ‘custom_sanitize_user’, 999, 2);

    Do you have any idea how can I do it please?

    Best regards
    – Chris


    Hi Chris,

    The current WordPress release now allows login with username or email with no plugin needed. Perhaps you can solve your issue by removing our plugin and just using the core.


    Cristian Romanello

    Hi 🙂 Many thanks for your honest consideration.

    Have a good work
    – Chris

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.