Add the below code in your active theme’s functions.php file.
function wpse_delete_query_transient( $post ) {
// Deletes the transient when a new post is published
delete_transient( 'd_results' );
}
add_action( 'new_to_publish', 'wpse_delete_query_transient' );
This will delete the transient every time when a new post is published.
If you want to delete the transients on differrent post status transitions, you may refer codex
Related Posts:
- Get the timout value of a saved transient?
- What is the best way to cache pages and queries in WordPress?
- How to delete a transient on post/page publish?
- Transient not working for custom loops
- Difference between fragment caching and wp_cache
- How to remove duplicate query on page load or make them cacheable
- How many queries are normal to execute on a WP site?
- Why a URL with a query is always slower than that without a query?
- Transient api Caches confused
- How to write update query in WordPress to expire transients
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Differences between wpdb->get_results() and wpdb->query()
- Using WordPress public query variables
- Storing posts social counters by using transient api
- wpdb get posts by taxonomy SQL
- How to List Events by Year and Month Using Advanced Custom Fields?
- Is there any difference between hooks posts_where with posts_join and posts_search performance wise?
- Should the caching of WordPress menus be specific to each page?
- Get a user’s most recent post title
- $query->query_var[‘post_type’] not set for pages
- Different Main Navigation per category
- Show recent products first but “sold out last” in query
- Show All Posts Insert Edit Link
- Get IDs of posts currently visible on archive
- Get posts by category with pure SQL query
- can’t get query to order posts by acf datepicker
- Custom query to get terms from post ids
- Help with wordpress custom query and advanced custom fields plugin
- WordPress query by category, sorted by custom field
- Mysql / WordPress killing my server with 80k users [closed]
- Query all posts and not repeat the same tag
- Deleting data from a custom table in WordPress
- Transient API and caching Plugins
- How to cache posts based on $_GET? Option name is too long? Options / transients
- How to optimize my query filtering out unwanted data?
- Remove posts from query for events whose start date has passed
- Insert static element only once in query archive
- How to run a mysql query when admin updates user role?
- Error when using setup_postdata()
- pre_get_posts : ‘post__not_in’ doesn’t work with global variable
- Getting post data from private page
- Missing posts in a query
- Alter a specific query on WordPress
- SQL query to select posts from multiple categories
- Protect sequence of pages with same password for each of two groups of users
- How is it possible to get top comment from all children?
- Select Query demand excesive resources [closed]
- Create Indexes for Slow Queries
- Query to get number of posts last week
- I want to create a filter for the query string is this possible?
- Exclude categories from the_category();
- How can i show all categories using wp query?
- All in One Calendar Plugin Custom Post Type Query [closed]
- Get Posts from Last 24 hours and Sort them via GD Star Rating
- Query returning same results even though the ID changes
- Why my query ‘REPLACE INTO…’ does not work?
- Restrict query to last day with posts
- Custom query object with Simple-Fields custom date field
- How to read the value of a WordPress $query associative array (hash) key
- Query posts based on previous query
- Waypoints + infinite scroll with custom query
- Customizing the_tags output?
- Querying with WP query using meta key price
- Re-sort get_posts query results
- How do I get all results from my query
- Taxonomy filter under Polylang
- WordPress Mysql query and Duplicate
- How to create an overview of posts with the same tag?
- create a link to a random post within the current category
- How to “orderby” the first array in a meta_query that uses multiply keys?
- Pagination not working on custom post types with rewrite slug
- JetEngine Query Builder – order by value from repeater
- Change pure SQL database query to WordPress post query?
- Filter orders by modify date
- How to add url parameter to every search query in SearchWp?
- Save large WP_Query to transient === false
- Woocommerce – how to round up all prices to end in .99
- Heavy meta query causing SQL crash
- Sort by postmeta on when searching
- Pulling an ACF into a query
- Speed up search query that searches in post meta?
- modifying main query to query for ranges e.g. from 1999 to 2016
- Querying users by meta value and getting a strange answer
- How can I display a number to represent the order of post?
- Problem on wpdb queries, wp_insert_post, wp_insert_user etc. The query runs twice
- Should I use transients for these API call results?
- Sort loop with query in the link
- About WP’s save_post action
- $wpdb: how to use a query as a base for another query?
- Multilingual WordPress page – using URL to determine language?
- list or get meta_key where meta_value is ‘something’
- Query posts alphabetically within this function
- WP_Query with checkbox meta_query – WordPress [duplicate]
- How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
- update $wpdb one query
- Admin Post List table Query filtering “WHERE” for custom post type
- Ascending & descending posts on same page with IF statement
- How to use a dynamic term id for the query block
- Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155
- How can i store cache of wordpress a database request without plugins?