Seems like there’s a plugin out there that does quite this!
It’s VersionPress!
In this blog post is explained what they used to track all the complicated changes.
Instead of using the ‘query’ filter they use the option to create a db.php file in the wp-contents directory to extend $wpdb like explained in this post: wp-content/db.php : where is this file?
Related Posts:
- Which filter/action hook gets triggered after a query has been performed?
- Order by custom table and multiplication
- WP_Query – How to get all posts of specific days of week by custom field date?
- Filter WP_Query output before it is accessed (pre_get_posts)?
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Use REGEXP in WP_Query meta_query key
- How to list some posts first in the loop based on post id
- Whats the difference between post_limits and pre_get_posts?
- How to add taxonomy filter on the query fly?
- Hook/action after WP_Query gets posts to query custom tables for post-related meta
- WP_Query – filter or directly?
- Should I use Transients with W3 Total Cache APC Caching? [closed]
- What is the most efficient way of querying posts based on visits and date for current day?
- Add indexing to meta_value in wp_postmeta
- Get posts by menu ID
- Changing Posts Per Page and offset with pre_get_posts
- ajax category filter
- How to order posts tag by tag?
- Overriding The Loop with filter or hook
- Slow SQL_CALC_FOUND_ROWS Query
- Custom query incorrectly returning everything [closed]
- WP Rest API v2 return posts with specific tag
- RSS feed with specific keyword
- Is there an action/filter called when WP_Query->query is finished and assigns posts
- How to filter sql only for a specific post type
- Actions or filters fired when data is saved in a custom table
- Ignore a filter on the media library
- How to support multiple search terms query within one process?
- What is an efficient way to query based on post_meta?
- How to get any tag ID
- Display different number of posts from one category on the different pages
- WP_Query Performance Issues with meta_query
- Should close $wpdb via $wpdb->close()
- Get the post permalink within the loop but without additional DB query
- Filter WordPress posts by between parameter
- Remove ellipsis from the excerpt retrieved using get_the_excerpt()
- Retrieve featured image (thumbnail) url from multiple posts with one query
- Removing posts from the returned wp_query. Cannot use object of type WP_Query as array
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- What’s the point of the query_vars filter?
- Including only current user’s posts in search
- Refine/Filter WP_Query Posts with jQuery or Ajax
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Use ‘parse_query’ filter to show posts that from multiple criteria
- What’s faster? One big query, or several smaller ones?
- How to apply filter inside a single wp_query?
- What is considered a default query for the request filter?
- Using apply_filters(‘the_content’, $custom_query->post_content) alters output
- Modifying the Search Results
- When to add_filter() to Custom Query
- How WordPress attaches its Featured Images with posts?
- Query total number of posts
- How to add post_distinct filter to WP_Comment_Query?
- why update and delete query not worked in custom table?
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- How to use filter hook “the_posts” with a function that refers to $this?
- How to create a WordPress Post Filter that users can use to filter posts by year?
- add_filter() depending on search term
- query_vars filter not working even though query string parameter is present
- How do I run through a WordPress loop called from a filter function?
- add_actions called from functions.php not returning good values
- Order by title without taking into account ‘the’
- How can I filter by slug depending on language selection
- wp_query ‘s’, search filter with pagination is not working
- How to filter, restrict and return posts based on custom user meta information
- Bypass “supress_filters” in WP Query
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- How to use the query hook/filter?
- Filter posts in category archive page by year using a dropdown
- Set global $wp_query/$post variable for dynamic page generation
- Display filtered results into custom page
- WP_Query ignoring tax_query when is_singular
- How to implement a new row_count method in WordPress?
- querying data via $wpdb and get_row
- Applying posts_clauses filter to specific queries only
- wp_Qwery works to slow
- Add class to first post in custom loop using post_class filter
- Show all data in database table and make it into an interactive table
- WP_Query with different postmeta filter for each categories
- Slow WP_Query with ‘OR’ on meta_query
- No results found from a $wpdb->get_results() query when trying to join more than one meta key query
- Add posts to WP Query object
- Filter Posts from the Main Query
- database query with more than a couple meta hangs and doesn’t complete
- How to alter local query, not main query [duplicate]
- How to filter a query by date in a shortcode?
- How can I allow sticky posts but cap the query to 1 post?
- how to access query string in wordpress?
- How to access custom WordPress database tables
- How can I override one post and make it display content for another post?
- Filter Custom Taxonomy Posts
- Is it possible to query from external database? [duplicate]
- Include posts from some categories while excluding from others
- WP User Query with Custom Fields and Search Results
- Changing the default wp_search_stopwords
- List of ways to access WordPress database?
- Filter post query to only show direct children of category
- Specify strict ‘order by’ in WordPress query
- Is it possible to add an argument to a custom function added to a filter hook?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]