Ok I spent an awful amount of time trying to debug this! Searching around I used $wpdb->queries
along with define( 'SAVEQUERIES', true );
to debug queries made when wp-cron was running.
then I found out that when cron jobs were running, my query was set to 'post_status' => trash
! No wonder I didn’t get any errors and as it turns out, I was trying out a specific query the other day and there was this function still running in my theme functions.php
and only affecting non logged in users which was overriding my cron query!
So long story short, nothing to do with wp-cron or wp_query (and even my code), clean up after your tests (I should know better ::facepalm) and make use of debugging tools to help you find the culprit!
Related Posts:
- WP Cron and wp_insert_post
- cron job for custom post type not working since WordPress 5
- Updating an intensive wp_query result once daily
- WordPress: Cron locking and Queue
- Wrote a WP Cron Plugin and it triggers a fatal error upon activation
- How to Insert data with wp cron
- Can I force WP_Query to return no results?
- Use the page slug in a WP_Query?
- paginate_links() adds empty href to first page and previous link
- Using OR conditions in meta_query for query_posts argument
- Get array of posts from the current archive page loop
- Get posts by menu ID
- count posts from custom taxonomy terms by year
- How to grab metabox value in wp_query meta_query key
- Woocommerce query by price range and custom meta key
- Get posts with condition on comment meta value
- Stop all SQL_CALC_FOUND_ROWS wordpress queries
- Move posts to top of WP_Query if in certain Taxonomy?
- WP_query ‘orderby=none’ Problem
- Pagination not working on static page
- How can I create a WP_Query that returns posts where one meta_value
- ‘paged’ in wp_query doesn’t work
- Sorting meta_value as integer doesn’t work
- Get posts from the Main site to sub site – WordPress MultiSites Network
- Custom Field Query – Meta Value is Array
- Get array of current post term ID’s
- WP_Query for showing specific post by id
- Ordering by meta_value AND date NOT WORKING with wp_query
- Query all posts in a given taxonomy
- Page navigation doesn’t show when query category
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- Query “Category A” + 1 post from “Category B” – how?
- Unexpected end of file
- WP_Query To call data from diffrent tables
- new WP_Query with author argument return no results
- Clean up WordPress code that repeats
- WP_Query: “post_parent” and “post_type” combination returning strange results
- Display Featured Post by Categories and Avoid duplicated posts
- How to use the query hook/filter?
- How to show optimized list of posts with all their attachment images
- Posts not showing per category after WP_Query?
- wp_query exclude word and category
- WP_query return more results than SQL query. post_count > found_posts
- How do I exclude the lowest level terms in a taxonomy?
- How can I query users by custom role?
- Pagination inside of a edit page
- How can I allow sticky posts but cap the query to 1 post?
- Problem with is_tax in WP_Query loop
- Need Sub-category with main Category
- Easy way to write complex queries in wordpress
- Error with function in functions.php?
- I am having problem sorting custom post type using WP_Query
- WP_Query and is_page_template() conditional
- Exclude recently updated post from custom WP_Query using multiple loops
- difference between querying database and using the loop
- How to do logical OR in terms in WP Query?
- Slow Query On Search
- Loop posts based on permalink term
- Child pages not affected by orderby
- Write WP Query that selects posts that are part of the same two categories
- Error in meta_query not get result
- Custom wp_query – I’m getting ‘all’ post, not the specific post in the query
- How to get current page nearest parent id?
- How to create Page templates for showing Blog posts in different layouts?
- wp Query Posts to display in Nivo Slider
- How to get only ONE category of “Portfolio” posts to display on main page rather than ALL categories?
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Strange behaviour of hierarchical taxonomy archive
- Is it normal that get_post() gets run 300 times and the content of those posts aren’t visible?
- meta_query – check for multiple meta values in key which holds an array of values
- How to sort wordpress posts already selected by WP_QUERY
- WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php
- how to get wp_query posts only first letter of alphabet A?
- Get posts having meta value between two numbers
- Merge wp-query and get_users
- WP_Query how to add a thumbnail to the first post from the last 5 posts?
- How order by works?
- Query by meta value (add a dropdown of all values)
- taxquery taxonomy get terms
- Using modified ‘meta_key’ to set ‘orderby’ in WP_Query?
- Calling a function with WP_Query only ever brings the first result
- get last child post by wp_query
- WP_Query don’t working with fixed post_id and term_taxonomy
- Create multiple sections for all categories and then queries all the posts for each of those categories
- Using orderby with 2 meta keys
- wp_query – Modify $query to include duplicate content
- $wp_query when new WP_Query
- Query to get all the posts of more than 2 meta_value having same meta_key?
- WP Query get posts by specific author IDs if one of several logged in authors
- Query specific number of posts for each post type in specific order
- Avoiding page loop
- Query Users by post count, last 30 days and display each users post count according to post type
- how do I exclude child categories from a wp_query?
- how to show only catergory titles on a page in wordpress
- Query All Posts: Either Display Most Recent or One with Particular ACF Value Chosen
- Can I use WP_Query to find a post with a particular menu_order?