0

I get a 404 page when loging in to wordpress for all my users. It adds an extra "/" so its like website.com//

I am using:<?php wp_loginout(urlencode($_SERVER['REQUEST_URI'])); ?>

So that after a user logs in, it brings them back to where they were.

Is there something wrong with that code? Any ideas? This might help: http://pastebin.com/28tURS8m Thanks

1
  • Is there a reason why you're running urlencode() on REQUEST_URI? It appears WP already has an esc_url() function that parses that variable when you run wp_loginout. Perhaps too much escaping is causing the extra slash?
    – James
    Jun 19, 2010 at 3:42

1 Answer 1

0

OK. I actually had a few minutes to test this on my Wordpress 2.9.2 blog.

The issue you are having, as mentioned in my comment, is that you're escaping $_SERVER['REQUEST_URI'] in your paramters of wp_loginout(). That function, wp_loginout(), already has a url cleanser called esc_url().

So, if you just write...

<?php wp_loginout($_SERVER['REQUEST_URI']); ?>

... your code will work as you want it to.

2
  • James works great. I really appreciate it. I had taken the code from some forum, no idea what it meant. Wish i could give you plus1 :) not enough reputation... Jun 19, 2010 at 4:33
  • No worries. I'm glad it worked. Escaping strings can always be a tricky endeavor in PHP development. Every function does it different or behaves in a way that puzzles one for hours.
    – James
    Jun 19, 2010 at 6:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .