Skip to main content
3 of 5
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/

do more action after wordprss login successfully

I have a simple requirement, after user login set the login user session and then redirect to another page.

Yes, I found some similar page from here is-there-a-hook-that-runs-after-a-user-logs-in

As the post said, what I need to do is like this:

function set_blog_session(){ $_SESSION['blogger'] = get_current_user_id(); wp_redirect("http://www.google.com");//just for test } add_action('wp_login', 'set_blog_session'); 

But I got nothing.

First, get_current-user_id() always returns 0.
Second, no redirect at all.

Whats going wrong?

diligent
  • 289
  • 2
  • 4
  • 11