Created
May 6, 2016 20:28
-
-
Save corenominal/3618108554a13ba4885f4c624b4b08bc to your computer and use it in GitHub Desktop.
WordPress action rest_api_init hook to set a global variable for testing whether or not the user is logged in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function global_is_user_logged_in() | |
{ | |
global $iewp_crunchstats_logged_in; | |
$is_user_logged_in = false; | |
if ( is_user_logged_in() == true ) | |
{ | |
$is_user_logged_in = true; | |
} | |
} | |
add_action( 'rest_api_init', 'global_is_user_logged_in' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment