Fixed it. After all it was really dumb error on my part.
The WP_Query() does not filter out unpublished posts by default. The internal archive page query does filter these posts out.
I had to add 'post_status' => 'publish' to the $query_args array and everything is now working as expected.
The final query then looks like this:
$query_args = array(
'post_status' => 'publish'
'post_type' => 'post',
'posts_per_page' => get_option( 'posts_per_page' ), // 10 by default
'offset' => get_option( 'posts_per_page' ), // 10 by default
'cat' => 8 // the category ID
);
Related Posts:
- AJAX Breaking Offset Argument In WP Query
- WordPress WP_Query offset parameter not working with search parameter
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- wp_query->max_num_pages always returns 0 on custom post type
- ajax category filter
- next_posts_link not working for loop called with ajax
- Ajax and WP_Query/tax_query parameter
- Load more AJAX on WP Query
- get data from wp-query, outside the loop & without url change
- How to adjust found_posts so that it accounts for offset and pagination
- How to pass custom parameter to WP_Query for filtering in pre_get_posts
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- ‘posts_where’ filter not applying ‘WP_Query’ in `wp_ajax`
- Using AJAX to return search form results
- WP Query with offset breaks wp_pagenavi or any pagination
- WP_Query class not found
- Search – Ajax – Alter Query Parameters with Pagination
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- Exclude first 5 posts of specific categories in the main loop
- Custom query, works, but I get a “Notice: Undefined offset: 0…”
- How to wp_query posts with ajax
- How to get user_id from wordpress database inside ajax function?
- Update Loop with Form
- WP_Query & AJAX
- Sticky Post default functionality with WP_Query is ignored when using AJAX
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Show selected images on top in Media Manager
- Prevent duplicate post from dynamic multiple loops
- WP_Query ajax loader detect end of posts
- Offset Page Loops and Pagination
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- How to use offset in WP_Query
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- Include custom field in Ajax search WordPress
- Ajax Pagination on Ajax filter
- Wp_query returning only one post while query through ajax
- How can I fix: “Notice: Undefined offset: 0”?
- WP_Query, pre_get_posts and offset
- Load More Posts Button – AJAX
- how to handle multiple ajax wordpress queries?
- Ajax WP_Query reutrns no results on author.php
- Current post in AJAX call is always zero
- WP_Query with offset and ‘orderby’ => ‘rand’, offset not working
- Ajax future single post query doesn’t work when NOT logged in
- how update data through ajax and jquery
- WP_Query arguments order
- Error with function in functions.php?
- WP_Query – Adding “offset” posts to the end of the loop
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Apply query arguments after the nth post
- Change AJAX filter from POST to GET for URL Parameters
- Loading two different AJAX requests on two different pages
- Apply filters to main query instead of creating new one?
- Page navigation doesn’t seem to work when I add offset?
- The best way to store variable across different widgets
- How to use a dropdown to filter posts by custom field
- Does WP_Query ‘responds’ badly to empty arguments?
- Retrieve data from wordpress db via input and put those result in dropdown
- WP_query is not returning the expected result
- ajax wp_query conditional tags not working
- I need to run a AJAX Fuction from within a WP_Query but only works on first item
- Offset WP_Query by negative 1
- Change post query onclick
- Add AJAX “Load more” on custom query block
- How to filter a static post page with ajax and $wp_query
- Ajax (jquery) wp_query pagination returns -1
- How to pass the current content of $wp_query to a new page?
- JOIN filter doesn’t work in WP_Query in wp-ajax calls
- WordPress AJAX Request returns 400
- WordPress Ajax form filter | Search by title with ajax form, breaks the other filters
- Why when I using infinity scroll the one post loads over and over?
- Using Ajax and WP_Query to load more posts on category page fails
- WordPress live search and filter custom fields
- WordPress live search and filter
- Filter admin ajax data by url query
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Finding post ID dynamically on click
- Load WP Query with Ajax
- remove_action – pre_get_posts – does not restore original query
- Is instantiating WP_Query not possible within an admin Ajax call?
- WordPress conflict with multiple load more posts functions on click
- WordPress custom query by archive title
- Using something else instead of using 9 wp_query
- Show All with Isotope
- Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Featured Image as Background with Offset
- Fetching $_POST from Page Template into functions.php
- WP_Query for liked posts is showing all posts if none are liked
- Declare inline background image in functions.php
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- Why is $wp_query fetching nothing?
- Inline Ajax call after term is appended with a @ or # etc. displayed in div
- Fire query on ajax post url page
- How return normal search result using wp_ajax action for wordpress
- Refresh wp_query with no changes
- WordPress WP_User_Query ignores the `meta_query` when called from an Ajax function
- AJAX search function resets wp_query vars
- WordPress Ajax search filter on dropdown select
- Multiple WP_Query with pagination shows Page/2 content on the remaining pages