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?
- How to list some posts first in the loop based on post id
- How to add taxonomy filter on the query fly?
- 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
- 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
- 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
- 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
- Filter WordPress posts by between parameter
- Retrieve featured image (thumbnail) url from multiple posts with one query
- 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?
- What’s faster? One big query, or several smaller ones?
- How to apply filter inside a single wp_query?
- When to add_filter() to Custom Query
- 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
- How can I filter by slug depending on language selection
- wp_query ‘s’, search filter with pagination is not working
- 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?
- Display filtered results into custom page
- How to implement a new row_count method in WordPress?
- Applying posts_clauses filter to specific queries only
- 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
- 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 custom WordPress database tables
- How can I override one post and make it display content for another post?
- Changing the default wp_search_stopwords
- Filter post query to only show direct children of category
- Is it possible to add an argument to a custom function added to a filter hook?
- I need help using pre_get_comments to limit comments in the comments admin screen
- Using Transients
- Slow Query On Search
- how to write wordpress query for multiple metakeys checking?
- Retrieve data from wordpress db via input and put those result in dropdown
- WP_Query with page_ids in arguments without a result
- Filtering by multiple conditions in the loop
- meta_query weird behaviour, static int will work, but not user data
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- Custom meta_query order for Elementor based on post meta key [closed]
- Why last row deleted when refresh page
- the wp_post_update isn’t working all the time
- Custom filter from post meta
- Query a database based on form input then output to another page [closed]
- How to get meta key list efficiently?
- How to get user avatar via WPDB
- How to extend WP_query to a specific table?
- update_post_meta performance in a loop woocommerce
- Insert wp_query after the_content with plugin (filter the_content won’t work)
- Separate by Category Post Type
- get term objects and post objects in query
- I removed the “wp_rm_logs” table and am constantly getting this error
- How to set selected attribute on option after filter query?
- Issue generating custom filter for cpt admin columns
- Include post_status check within $wpdb query
- wpdb get_results() returns only 2 rows
- Website goes slow down after importing long database
- WP_Query always returning the last custom post
- Custom query with post_class filter using current_post not working
- Optimising amount of calls to custom fields
- Loop the posts between two dates selected using jquery datepicker
- Edit WordPress loop, taxonomies, & filter
- Custom WP_query in Jnews theme returns thousands of posts
- SQL query into to WP query
- List categories using WP_Query
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)