• Resolved deolram

    (@deolram)


    Currently I’m testing comments on my site. When the user is not logged in, there is a message that says “You must be logged in to make a comment.” When clicking on “logged in” it’s supposed to take them to the login screen with the variable “redirect_to” being set to the_permalink() value.

    Here’s the link:
    Overtime

    When you go to the bottom and click on the “logged in” link, you get a 404. However, if I simply remove the “https://” that is directly after “redirect_to=” then the url works fine.

    This was happening before I tried using custom permalinks. Any help would be much appreciated.

    Thanks,

    Jeff Stone

Viewing 2 replies - 1 through 2 (of 2 total)
  • Open comments.php and look for:

    <?php if (get_option('comment_registration') &amp;&amp; !$user_ID ) : ?>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.

    Check the link url code. It should be:

    <?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>

    My guess is that you’re missing the urlencode().

    Thread Starter deolram

    (@deolram)

    Esmi,

    Thanks for the response.
    Here’s my code:

    <?php if ( get_option(‘comment_registration’) && !$user_ID ) : ?>
    <p>You must be /wp-login.php?redirect_to=<?php echo urlencode(the_permalink()); ?>”>logged in to post a comment.</p>

    I added the urlencode… still didn’t work.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp-login.php?redirect_to not working’ is closed to new replies.