0

I am building my website on Wordpress and I have created my custom login page.But for a post when an user comments and other nonlogged see the comment with along with a line down "Login to reply".And when the user clicks on that"Login" from "Login to reply" it redirects to wp-login.php.So how to redirect users to custom login page when "login to reply" for a post is clicked on wordpress instead of wp-login.php.

0

Try using this in your functions.php file or in a plugin file-

add_filter( 'login_url', 'wpse_290288_custom_login_url', 10, 3 );
function wpse_290288_custom_login_url( $login_url, $redirect, $force_reauth ) {
    $login_page_id = 123; // ID of your custom login page
    return get_permalink( $login_page_id );
}
  • wow! Code working Sir ThankYou So Much For The Help Sir, – Muhammad Shahzeb Jan 7 '18 at 20:40
  • Nice to hear that @MuhammadShahzeb. In that case, you should mark this answer as "selected". See this screenshot: i.stack.imgur.com/5G4f3.png – mukto90 Jan 8 '18 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.