How to get user id logged in
-
Hello,
i need to read the id of the user logged in through ajax.
the php file (user.php) that I call from the ajax script contains the following code:define('WP_USE_THEMES', false); require('../wp-load.php'); $user_id = get_current_user_id(); echo $user_id;
If I run this page directly from the browser, I get the correct id of the logged in user running the page.
If instead I call the php file from the Ajax script, I get the user id equal to 0.How can I solve the problem?
thank you.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to get user id logged in’ is closed to new replies.