WPML

Overview of the Issue

When using WP Hide & Security Enhancer with WPML, you might experience the following issue: when you set a custom login URL (New Login) in WP Hide & Security Enhancer, the log-in links on pages in a secondary language point to the language directory, for example /es/my-login. That address shows a 404 page. The login page at /my-login works.

Workaround

Back up your site first. Then add this code to the functions.php file of your child theme, or to a small plugin. The code removes the language directory from the log-in link, so the link opens the login page in every language.

PHP
add_filter( 'login_url', function ( $url ) {
    $lang_home = untrailingslashit( home_url() );
    $home      = untrailingslashit( get_option( 'home' ) );
    return ( $lang_home !== $home && 0 === strpos( $url, $lang_home . '/' ) )
        ? $home . substr( $url, strlen( $lang_home ) )
        : $url;
}, 1000 );

All known issues

Need Help with This Issue?

Ask a support question and we’ll look into it with you.