• Is there a way to use a custom link for a different domain in back to site button? I have a subdomain that is restricted from non logged in users and with that button i want to redirect them back to the main domain. I did find the function for backtoblog in template-loginpress.php file but just replacing the ahref does not work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Abdul Wahab

    (@abdulwahab610)

    Hi, @vngls7

    Yes, you can add your custom back site URL. For this, you don’t need to make changes in plugin core files. By using the hook, go to your theme’s functions.php file and add this code snippet there

    **
    * Modify the wp-login.php 'Back to' URL
    * @param String $url
    * @return String $url
    */
    function prefix_home_url( $url ) {
        global $pagenow;
        if( 'wp-login.php' === $pagenow ) {
            $url = 'https://yourdomain.com/';
        }
        return $url;
    }
    add_filter( 'home_url', 'prefix_home_url' );

    You can replace the yourdomain.com with your actually URL.

    Thank you.

    Thread Starter Vangelis Giannakis

    (@vngls7)

    Thank you!

    Plugin Contributor Abdul Wahab

    (@abdulwahab610)

    You are welcome ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom back to site url’ is closed to new replies.