I believe Milo is right, it’s probably a filter affecting this. Ajax requests look like admin requests (that is, is_admin()
returns true), so it’s possible that something is checking if is_admin()
and adding the filter in those cases.
You can set 'suppress_filters' => true
in your args array and it will probably work. Note that doing so can prevent a query from being cached, or prevent plugins from doing what they need to with a query. It’s possible that this may not affect you, but still something to keep in mind.
Related Posts:
- Order & Orderby clause not working with custom query
- Change post query onclick
- how to retrieve WP_Query without ordering by date [duplicate]
- Add AJAX “Load more” on custom query block
- How to filter a static post page with ajax and $wp_query
- wpquery via ajax
- Ajax (jquery) wp_query pagination returns -1
- orderby ignored by wp_query
- How to pass the current content of $wp_query to a new page?
- Sort posts using multiple custom fields and menu_order in single query?
- JOIN filter doesn’t work in WP_Query in wp-ajax calls
- WP_Query orderby
- WordPress AJAX Request returns 400
- WP_Query order by multiple meta keys & fields
- 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?
- What’s wrong with this meta query? (order by meta key, then title, doesn’t work)
- Using Ajax and WP_Query to load more posts on category page fails
- How can I order a post query’s results based on the number of matching taxonomy terms?
- How to sort store location by specific category order in WP store locations
- How to sort wordpress posts already selected by WP_QUERY
- Custom WP Query order function possible?
- Custom order of posts in wp_query and different taxonomies
- WordPress live search and filter custom fields
- WordPress live search and filter
- WP_Query random ordering not working since 5.4
- WordPress Query custom ordering by temporary variable
- Filter admin ajax data by url query
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- Meta query orderby meta_value_num sorting by role first
- WP_User_Query Orderby Not Working
- Order by value of Custom Field using url string
- Order posts by tags count?
- Order by meta date with a thousanth of a second defaults to post order
- Finding post ID dynamically on click
- WP Query with meta queries
- Order Element By Custom Field in WordPress
- Ajax buttons not working properly in WooCommerce when using wc_get_template_part
- Load WP Query with Ajax
- Query Order By Number Variable From API
- How to get_comments() ordered by date and parent?
- Order 2 meta_queries differently in WP_Query?
- Sorting with meta_query and multiple, optional meta keys
- WP Query. Ordering posts by another post types meta
- remove_action – pre_get_posts – does not restore original query
- WP_Query: custom orderby (not ASC nor DESC)
- Best way to query posts and order by relevancy to query
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- Is instantiating WP_Query not possible within an admin Ajax call?
- wp_query sorting – one specific meta_key value at last and then sort by create date
- WordPress conflict with multiple load more posts functions on click
- WordPress custom query by archive title
- Show All with Isotope
- Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?
- query_posts based on a meta_key
- Display three sequential posts on each page load, without repeating previous
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- modifying the loop multiple times with arguments passed through ajax to wp_query
- Order posts by more than one variable (meta_key and publish date AND time)
- Create custom order sortby based on array of id
- Best way to Order Post in Home without a plugin
- orderby in WP_QUERY – Use the order from the Dashboard
- Fetching $_POST from Page Template into functions.php
- Sort by meta key within same day
- Find by post_meta, then sort by post_meta, then sort by date (wp_posts)
- Query All Attachments and Order by Parent Publish Date
- WP_Query for liked posts is showing all posts if none are liked
- Declare inline background image in functions.php
- How to get query results for the next page
- Order Custom Field by Price
- How to solve this script problem in theme directory?
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- WordPress WP_Query offset parameter not working with search parameter
- Why is $wp_query fetching nothing?
- Using orderby with 2 meta keys
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Order WP_Query results in order other than ASC or DESC
- Show sticky post before other WP_Query
- Inline Ajax call after term is appended with a @ or # etc. displayed in div
- Custom query to order by multiple taxonomies
- Fire query on ajax post url page
- Sorting Posts Based On Meta Value Using AJAX
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Get post closest to today
- Order by multiple meta keys on wordpress
- orderby in WP_query doesn’t works
- How return normal search result using wp_ajax action for wordpress
- Posts2Posts, wp_query and orderby issue
- WP_Query with several meta_query-statements and order by meta_value
- Order by meta values
- Change posts archive ordering
- Duplicate posts showing up in loop using infinite scroll
- Adding arguments to WooCommerce Product Loop using AJAX
- orderby and order filter in get_posts or WP_query function in wordpress not working
- Get posts that were most recently tagged
- Refresh wp_query with no changes