Neil James Viewing 3 replies - 1 through 3 (of 3 total) The topic 'wp_get_current_user returns an ID of 0 even if user logged in' is closed to new replies. rev2023.3.3.43278. Otherwise if id is a number it seems to try to read it possibly from the cache, or from the database using ->get_data_by(), which can also update the cache. Adds inline scripts required for the WordPress JavaScript packages. I have a PHP page at the same level as the template/theme on WordPress. Retrieves the URL to the users dashboard. I have a wordpress installation, lets say for arguments sake it's installed to http://www.example.com/wordpress. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. A place where magic is studied and practiced? 1. WordPress is a trademark of the WordPress Foundation, registered in the US and other countries. Loads the comment template specified in $file. As expected, it is not above output. How can I explain to my manager that a project he wishes to undertake cannot be performed by the team? Instead, define a function that gets the user information: function wpse_58429 () { // Get the current user's info $current_user = wp_get_current_user (); if ( ! Call to undefined function wp_get_current_user() [fixed] - indev Topological invariance of rational Pontrjagin classes for non-compact spaces. Renames $_POST data from form names to DB post columns. The best answers are voted up and rise to the top, Not the answer you're looking for? - fusion3k Apr 8, 2016 at 11:05 However if I move the file to the root directory of the site and call it by going to http://www.example.com/test.php, it outputs 0 as if there were no user logged in. I have a file called test.php with the following code: Now the odd part is if i have a user logged in and place this file within my wordpress directory and call it by going to http://www.example.com/wordpress/test.php it outputs the correct user id of the current logged in user. Is it correct to use "the" before "materials used in making buildings are"?
Branch Connally Death, Articles W