• How can i get the current logged in user id NOT the user authenticated by the rest api.

    get_current_user_id() shows the user using the rest api. That is NOT what i need.

    Also how can i disable server cache and browser cache entirely in wordpress?

    I tried:
    define( ‘WP_CACHE’, false );

    and in apache .htaccess

    <IfModule mod_headers.c>
    FileETag None
    Header unset ETag
    Header unset Pragma
    Header unset Cache-Control
    Header unset Last-Modified
    Header set Pragma “no-cache”
    Header set Cache-Control “max-age=0, no-cache, no-store, must-revalidate”
    Header set Expires “Thu, 1 Jan 1970 00:00:00 GMT”
    </IfModule>

    still doesn’t work… the cache continues persisting.
    Not using any caching plugins…

Viewing 2 replies - 1 through 2 (of 2 total)
  • How can i get the current logged in user id NOT the user authenticated by the rest api.

    These would normally be the same thing. How are you using the API such that the authenticated user is not the current user? If you’re authenticating your application as one user, but a different user is ‘logged in’, then how are you achieving that?

    Thread Starter fymfifa

    (@fymfifa)

    currenly i am using a cookie with encoded user id during login.

    I want to get the current logged in without a cookie in woocomerce filter “woocommerce_rest_prepare_product_object” filter. NOT the rest api authenticated user.

    These would normally be the same thing
    I know it’s the same thing but thats not what i need.

    I need THE LOGGED IN USER not the one using the api.


    If you’re authenticating your application as one user, but a different user is ‘logged in’, then how are you achieving that?

    may be you didn’t understand the me. I want to archieve extactly that, but apparantly i don’t know the wordpress core well enough.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wordpress Current User Id not authenticated by rest api & disable cache’ is closed to new replies.