Errors with Wordpress Comment Login

I’ve found that on some of my Wordpress sites since upgrading to version 2.7 that if a user clicks on the link to login to leave a comment they would not be taken to the login page. I was able to fix it by copying some code from the default comments.php file to the theme I’m using.

Old code:

<p>You must be <a href=”<?php echo get_option(’siteurl’); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>”>logged in</a> to post a comment.</p>

New code:

<p>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.</p>

I hope this helps anyone experiencing the same problem.

Tags: ,

Leave a Reply

You must be logged in to post a comment.