• Resolved typeless

    (@jbalyo)


    I had created a custom login script for non-WP parts of a site, in order to incorporate some WP session features into those parts as well… However, after upgrading to 4.0, the wp_get_current_user() function returns an empty object with an ID of 0. Is there something different about this function in 4.0? Or was it depreciated altogether? Is there an alternative?

    Thanks for any advice.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter typeless

    (@jbalyo)

    Since I have no idea where to start with this, I just randomly tried switching the included file from wp-config.php to wp-includes/pluggable.php and got the following message:

    Fatal error: Call to undefined function apply_filters() in /htdocs/wp-includes/pluggable.php on line 118

    Not sure if that means anything… but when I looked at that line, it seems to have something to do with creating the session.

    Also, I noticed that the wp_get_current_user() function works on some pages, but not on others, even though the code used to call it is identical on every page (it’s in an included file). It seems maybe the function is there, but some requirement must have changed about which file(s) need to be included in order to call it?

    Thread Starter typeless

    (@jbalyo)

    Okay, it appears to be related to SSL. Not sure why, but after the upgrade, my htaccess redirects to HTTPS broke, and wp_get_current_user would only provide information over SSL, so the pages that weren’t getting properly redirected were left out in the dark. Makes sense, I guess.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is wp_get_current_user() removed from WP 4.0?’ is closed to new replies.