In a plugin, I am initiating an ajax script:
function getthatable_callback() {
global $wpdb;
include("phpscripts/gettable.php");
wp_die();
}
add_action( 'wp_ajax_getthatable', 'getthatable_callback' );
add_action( 'wp_ajax_nopriv_getthatable', 'getthatable_callback' );
In phpscripts/gettable.php, I try
print_r(wp_get_current_user());
I call the ajax script like this:
jQuery.post(ajaxurl, {'action':'getthatable'}, function(data){
jQuery("#thatablecont").html(data);
});
I use Q-translate-X and have a multilingual option set to en.mydomain.com. The AJAX script, when I access the site as en.mydomain.com, outputs an empty object:
WP_User Object ( [data] => stdClass Object ( ) [ID] => 0 [caps] => Array ( ) [cap_key] => [roles] => Array ( ) [allcaps] => Array ( ) [filter] => )
But when I access it from mydomain.com, it shows well the logged-in user.
Thanks for help!