If you have followed the code of the recent page widget then what you are trying to achieve can’t be done as naively as you are trying to do it. Recent posts widget caching is based on the assumption that the same output is displayed everywhere which is why it can calculate the cache on any page and use it on any other page, but this assumption do not apply to your case as you want different output on some pages.
The easiest way to go around it is to have a different cache key for each post like recent-posts-{post id}.
Related Posts:
- WP JSON REST API (Ryan McCue) how to query posts with specific meta data with ‘AND’ relation?
- Creating two database tables via plugin
- Query Posts by Custom Field ‘Price’
- How to stop wordpress from changing default .htaccess permissions to 444
- WP_query parameters for date range
- insert data in database table from plugin with WP3.1
- Can I ignore caching of a plugin in W3 Total Cache? [closed]
- Thumb rating for wordpress – top user
- Comparisson between date() and a date from wp_postmeta
- Find out if request is for custom post type archive before query runs
- How to extract images of post and pages excluding header and logo image in wordpress?
- How to count number of records found in a database table?
- Fatal error: Uncaught Error: Call to undefined function get_userdata()
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Advanced Custom Fields query
- Error Message from W3 Total Cache when .htaccess Rules Cannot Be Modified? [closed]
- Can I run multiple queries with $wpdb->prepare?
- Plugin Expires Headers – W3 Total Cache [closed]
- How use %like% in sql statement wordpress
- medoo framework in WP plugin
- WordPress logo upload option in theme panel
- Accessing GET variable named ‘error’
- W3 Total Cache: Load CSS asynchronously for better PageSpeed score? [closed]
- WP_Query ordering numbers as letters
- FacetWP group listings by custom field [closed]
- How can i list random post from multiple category?
- how do i remove posts from a WP_Query so the pagination is right?
- Accessing post’s meta data based on user’s click of a post
- WooCommerce shop page orderby [closed]
- With W3 Total Cache when I publish a post it does not appear in the homepage. Only if i purge all cache [closed]
- Get posts from WP_Query and format them on admin_head
- Not getting author rank when using return
- How to query the custom fields by language?
- How do I “get the next 10 posts after post_id == x”?
- W3 Total cache “empty all caches” and no stylesheets render [closed]
- switched from query_posts to WP_query, not working now?
- AJAX search posts and pages
- Getting WPTouch and W3 Total Cache to Work Together [closed]
- What database state changes happen after a post is manually “updated” with no changes?
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- any word search WordPress
- Warning: call_user_func_array() problem can anyone help with it?
- Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php
- adding dynamic/multiple slug values in ‘option_none_value’
- How to get a specific string from a url
- My wp database has been hacked
- How can I disable W3 Total Cache Image Lazy Load for Specific Post Type?
- WooCommerce Product Table – filter query on attributes
- Performance considerations – postmeta table versus new table for custom posts with foreign keys?
- How to pass multiple custom fields as shortcode’s parameters
- Checkbox field that add a subscription product and change prices of other products in checkout and cart page
- Is it possible to custom set query for a WordPress REST API response?
- Only return taxonomies that are linked to a category & product
- How to add specific posts to specific pages in WordPress?
- How to use information from the database in the front-end?
- User Following System
- How to fix slow comment query?
- ACF Query result in a new td (echo)
- WordPress Dashboard shows no plugins installed!
- Multiple Meta key in search
- wp_schedule_event function reference
- Primary Menu doesn’t show because of w3 cache
- History of page, interval of years
- How to insert variable which contain array value in wp_options table?
- Trending Tags based on post views
- Shortcode in a blog post, footer and related products stop working
- Plugin does not create a custom table upon activation
- How to delete only user meta value (not key) from usermeta table in wordpress?
- How can i see/log all requests coming from a registration form (not from the UI)?
- Action hook “wp_insert_post” works but not for last imported post
- W3 Total Cache Can’t Really Detect Things
- using .htaccess only for wordpress security no plugins
- WP_Query Date Filtering Inclusive Being Ignored
- Second foreach loop breaking (Posts2Posts)
- Advanced Custom Fields (ACF) Plugin – Random Image in Sidebar
- Ger posts from similar tags and categories
- wp_query for more fields plugin
- WordPress filter function using query modifications
- wpdb get_var is not returning any result (verified mysql query returns only one value)
- WP-Snap too slow (caused by WP_Query?)
- WordPress Meta Query: Relation is not working correctly
- WordPress ultra slow if I click on posts?
- Insert data in custom table during new post creation
- Making a Custom Post Type Publish Loop
- Include subtitle display to slideshow
- Checking url from plugin [duplicate]
- W3 Total Cache and IIS7 not doing much [closed]
- WP Super Cache versus W3 Total Cache [closed]
- Browser Cache causes ‘Orderby=rand’ to return the same posts
- I want to display data last 7 days with date wise in chartjs?
- Order custom post type by posts with most likes first
- Accessing Correct Database to Create REST API Endpoint
- What is the easiest way to create a custom field archive?
- How to make WordPress ignore GET parameters when caching pages?
- WP_Query does not return the result even if the data is present in the database
- Show the author only own types of publications. (JetEngine, Elementor)
- How to filter posts with a wp query by a custom dropdown type field with the magic fields plugin
- Query Custom Post Types on Available Dates
- Shipping Refund via Stripe Creates New Order Instead of Updating Original Order
- Elementor: Exclude product categories when using “Source: Current Query”