Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var data = {
action: 'is_user_logged_in'
};, data, function(response) {
if(response == 'yes') {
// user is logged in, do your stuff here
} else {
// user is not logged in, show login form here
function ajax_check_user_logged_in() {
echo is_user_logged_in()?'yes':'no';
add_action('wp_ajax_is_user_logged_in', 'ajax_check_user_logged_in');
add_action('wp_ajax_nopriv_is_user_logged_in', 'ajax_check_user_logged_in');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.