Skip to main content
Correct spelling
Link
fuxia
  • 107.3k
  • 39
  • 256
  • 463

Do more action after WordPress login successfully

do Do more action after wordprssWordPress login successfully

replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

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-inis-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?

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?

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?

Source Link
diligent
  • 289
  • 2
  • 4
  • 11
Loading