While using the WordPress Ajax API to query certain posts the content of WP_Query is always empty (that means the class exists but every property is set to null or false).
function my_ajax_admin() {
$query = new WP_Query();
$tab = array();
while($query->have_posts()):
// never reached
endwhile;
die(json_encode($out));
}
}
Is it in general not possible to use WP_Query
in Ajax called? May I load something into the function to make it work? Do I require additional parameters?