How can i edit the link to the login on my comment note for a wordpress theme

Please I have surfed the web for this and I have not seen a helpful link.
I have a wordpress blog which a user must be logged in before he can comment on my posts.
Now my posts always have this note under every post when a user is not logged in

You must be loggedin to post a comment

Read More

And the loggedin link points to the wordpress ‘wp-login.php’ page.

Now I already have a custom login page which I am using for other login purposes. So I want this link to point to my custom login page instead of the wordpress ‘wp-login.php’

Or probably if there is a way I can redirect it to my custom login page.

Any link will be appreciated.

Thanks in advance

Related posts

Leave a Reply

1 comment

  1. Add following to your functions.php :

    add_filter( 'login_url', 'your_login_page', 10, 2 );
    function your_login_page( $login_url, $redirect ) {
        return home_url( '/your-login-page/?redirect_to=' . $redirect );
    }
    

    Above code will do the trick.

    You can check WordPress Codex for login_url filter.

    Let me know the output.