Tuesday, January 25, 2011

Wordpress: 404 page after logging in

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

  • 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.

    thegreyspot : 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...
    James : 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.
    From James

0 comments:

Post a Comment