It's confusing for unregistered users when they find this statement "You must be logged in to post a comment." takes them to the WordPress login page. As this is the case, I need to change it to user registration page.

  • There are many plugins such as Pie Register that exactly can do this for you.
    – Johansson
    Commented Feb 14, 2017 at 7:41
  • I already have the registration form and I'm using woocommerce. I just need to change the hyperlink "logged in" to the log in page for users. Commented Feb 23, 2017 at 23:11

1 Answer 1


You can use this code in your function.php:

$args = array('must_log_in'=> '<spam class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), HERE YOUR CUSTOM PAGE URL ) . '</spam>');
  • I added the code but it didn't solve the problem. I'm using woocommerce on my website. Commented Feb 23, 2017 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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