Admin-ajax responds with 0 due to empty $_REQUEST
In end of Ajax function you need to die() function function example_frontpage_feed_ajax() { require_once ‘inc/fetch-feed.php’; $fetch_page = isset($_GET[‘page’]) ? intval($_GET[‘page’]) : 0; $fetch_next_time = isset($_GET[‘next_time’]) ? $_GET[‘next_time’] : null; header(‘Access-Control-Allow-Origin: https://www.example.com’); example_feed_content($fetch_page, $fetch_next_time); die(); // This is important in ajax } add_action(‘wp_ajax_nopriv_example_frontpage_feed’, ‘example_frontpage_feed_ajax’); add_action(‘wp_ajax_example_frontpage_feed’, ‘example_frontpage_feed_ajax’);