• Hi, I noticed that the Whitelabel is not performed on the title of the page wp-login.php

    So it appears: Login – Site Name — WordPress

    To solve while waiting for your intervention I used the following code by inserting it in the functions.php of the theme:

    function custom_wp_login_title( $login_title ) {
        return str_replace( ' — WordPress', '', $login_title );
    }
    add_filter( 'login_title', 'custom_wp_login_title' );

    I also propose adding an option to force login and registration through the WooCommerce page if it is installed on the site so that when any user visits the wp-admin page they are redirected to the WooCommerce “my-account” page.
    I tried this:

    // Hide wp-login from guests
    function redirect_guest_from_wp_login() {
        // Check if the user is not logged in and if the request is for wp-login.php
        if (!is_user_logged_in() && isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'wp-login.php') !== false) {
            // Get the base redirect URL
            $redirect_url = home_url('/my-account/'); // WC My Account Page
            
            // Get the query string from the original URL
            $query_string = $_SERVER['QUERY_STRING'];
            
            // Parse the query string to get individual query parameters
            parse_str($query_string, $query_params);
            
            // Add the query parameters to the redirect URL
            if (!empty($query_params)) {
                $redirect_url = add_query_arg($query_params, $redirect_url);
            }
    
            // Perform the redirect
            wp_redirect($redirect_url);
            exit();
        }
    }
    add_action('init', 'redirect_guest_from_wp_login');
  • The topic ‘wp-login.php Page Title’ is closed to new replies.