You add WP Random Posts widget. Same posts appear every time. Not random at all. That is frustrating because you wanted fresh content.
A common issue is that the plugin caches random results. Cache plugin saves HTML. Same “random” posts served to everyone. The plugin is not broken. Cache kills randomness.
Why WP Random Posts Shows Same Posts
WP Random Posts queries database for random posts. Query result changes each time. But if your site uses caching, the HTML output is saved. First visitor gets truly random posts. Subsequent visitors get cached version. Same posts repeat.
This is not WP Random Posts being bad. Cache is the problem.
The Most Common Randomness Failures
- Page cache plugin (WP Rocket, LiteSpeed, W3 Total Cache)
- CDN cache (Cloudflare, BunnyCDN)
- Object cache (Redis, Memcached)
- Widget cache (plugin-specific)
- Browser cache (same visitor, same posts)
Cache at any level breaks randomness.
How to Fix WP Random Posts Randomness
- Exclude random posts widget from cache
- Disable widget caching in plugin settings
- Use JavaScript to load random posts client-side
- Set short cache expiry for random widget (1 hour)
- Clear cache after changes
JavaScript method is most reliable.
JavaScript Random Posts (No Cache Issues)
Instead of PHP widget, load random posts via JavaScript:
fetch('/wp-json/wp/v2/posts?per_page=5&orderby=rand')
.then(response => response.json())
.then(posts => {
// display random posts
});
JS requests random posts on each page load. No cache interference.
Alternative: Disable Cache for Random Widget
Add this to theme’s functions.php:
add_filter('widget_display_callback', function($instance, $widget, $args) {
if ($widget->id_base === 'random_posts_widget') {
return false; // disable caching
}
return $instance;
}, 10, 3);
This prevents caching of random widget.
People Also Ask About Random Posts Problems
Why does my random posts widget show same posts?
Cache saves results. Disable caching for that widget.
Should I stop using WP Random Posts?
Use JavaScript version or disable widget cache. Randomness returns.
Is WP Random Posts worse than Random Posts Widget?
Both have cache issues. JS solution works for any.
Final Thoughts
If WP Random Posts shows same posts, cache is the culprit. Disable caching for the widget or use JavaScript. Posts will be truly random.