0

I was trying this since 2days still not a good answer. Tired of Peter's login its not working.

I want to redirect a specific User (Like "John" or someone) to a specific Page. its a hidden one i want only him to access that when he logged. i have managed to add the wordpress login on a page.i want them to login via that.Would be very happy if someone could help me on this. i am not that familiar with codes as a beginner ???

1

Do you require that this user go to that specific page first upon logging in? Or can they go to the regular page after login and then just make them the only user allowed to view the specific page in question?

If the latter, try using the following:

wp_get_current_user();

http://codex.wordpress.org/Function_Reference/wp_get_current_user

Then test to see if it is the user you want. Make a custom page for the page you want (if you haven't done so already) and add this test at the top of the page. If any other user is logged in (or none at all) then display nothing or use:

wp_redirect( $location, $status );
exit;

http://codex.wordpress.org/Function_Reference/wp_redirect

to redirect all other users to the main page or some other page.

This approach seems (to me) a lot simpler than potentially breaking the normal login functionality.

1
  • Thank you. i tried wp_get_current_user(); with an if condition . it worked out.. thank you very much – shakee93 Oct 18 '14 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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