In the class WP_Query, there is a hook posts_pre_query
wich allow to set the result of a query before the DB call
https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/class-wp-query.php#L2755
Related Posts:
- Count & Display Database Queries
- cache specific data?
- get_results using wpdb
- Using transients in conjunction with memcached
- Hook into $wpdb
- Export wordpress table to excel
- How best to inject ads between posts in the loop?
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Hook to be used when creating a database table
- Change all http to https in mysql databse?
- WooCommerce – Query for ordered products
- PHP variable in WordPress database query
- Block search SQL from happening
- Usage of Direct Database Call Without Caching Error
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Query WordPress database by registered date and role
- Trigger Plugin database update after git pull
- How to prevent WordPress from retrieving data for the last 10 posts in the database?
- Query from a different database than the default
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Select Multiple meta_value from WP DB; Single Query
- CRUD operations using WordPress database API
- Transient feeds and caching error
- Advanced SELECT query with condtional statements
- Select two sums with single get_var statement
- Replace/Mute/Stop Search Query
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- WordPress returns to an old version
- How to Access wp_usermeta Data Immediately After a New User is Created
- How to update the values when the featured image has changed?
- How to prevent/delay MySQL connections when an object cache is used?
- How Can I Put Meta_Compare in the Database-Query?
- How to paginate information obtained from a query to a custom table?
- Historic WordPress database connection
- Check if an option exists and get its value in one hit
- Query multiple tables at once?
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- Best practice to limit results in get_row()?
- How to display content from external db with relevant urls
- Connecting to a different database
- Should I store critical css in the database or in my theme’s filesystem?
- content disappearing minutes after it’s published
- SQL query to set posts in bulk based on the post content
- Query Column of Specific ID from Database Table
- Custom search query by category id
- Website displays old version of page
- How to display data from db in select list [closed]
- How can I query the db to access current post information?
- Compare User meta_value with Product meta_value
- How to insert a value to decimal type field using wpdb->prepare?
- Join Query on WP_USERMETA Table
- Insert NULL value using prepare()
- WP 5.5, child themes, customizer and a weird cache issue
- Job and Employee Performance Tracking with Product Safety
- adding user_id and name to a separate table whenever a user register based on role
- WordPress Database Query works in phpMyAdmin but not in the code
- wpdb query to insert images in to post/page gallery
- Set SQL_BIG_SELECTS and MAX_JOIN_SIZE on a WP_Query
- About wp database hooks (error establishing connection)
- Performance bug – slow DB query
- How to optimise this database query?
- How can we speed up wp_get_nav_menu_items()?
- Extracted CSV as Array for Custom Query Loop
- Should I Use only wpdb Class to Write Custom Queries?
- Generating an HTML table from an array based on dynamic key values
- Improving wpdb queries with large data
- Pulling values from a sepcific row in table
- Using class id from array for query
- Attach posts based on category and position
- database search feature
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- How do I find users by password?
- How to disable publish_future_post auto add wp_options cron
- SQL errors when querying for something with apostrophes
- Intermittent Yet Problematic Error – “Error Establishing A Database Connection”
- WordPress site migration – locked out of admin area
- Get all top categories, then only 3 posts for each
- Best way to store 1 billion+ posts?
- Having all “non-PHP” files on a different server
- Can I use a wpdb object to connect to a non-WordPress Oracle database [duplicate]
- syntax error for changing user role from database
- Optimize WP site for millions of posts
- Is it safe to add INDEX to a column in WordPress database?
- Error establishing a database connection with XAMPP
- is it possible to install new WordPress in an old WordPress folder?
- I Want a More Concice Form of Data than an Array
- Malware in old website – how to migrate?
- Free version of Relevanssi doesn’t show ACF fields
- Can someoene please help with customization of a post?
- I would like some help wth an SQL query to link posts with categories
- Communication in between WordPress database and another (not WordPress) database
- How do I loop/iterate through posts to edit all img tags?
- Is it possible to separate databases in WordPress site – one for orders and the other for all non-orders related
- Error establishing a database connection in wordpress
- Where is the HTML-handler part in the wpdb class?
- A WP dev site that displays content from a live site’s database but cannot write to wp_posts?
- Exporting Post ID, Post Title, Primary Category and Primary Category ID
- Export only a part of the database for migration