AJAX action returning empty posts array?Posted: asked May 18 at 23:10 - Source : stackoverflow
I've created an action for an AJAX request to trigger. On the site, the action is successfully triggered. However, when I run this in the action:
$posts = get_posts();
The post array always returns empty.
This is how I am adding the action:
add_action('wp_ajax_nopriv_home_load_more', 'home_load_more'); add_action('wp_ajax_home_load_more', 'home_load_more');
Any ideas why this isn't working?