By default, users are not able to display Random Posts in WordPress.
Because, WordPress displays posts in reverse order. It means WordPress shows newly published posts at the top of the site.
For this reason, old posts go down gradually. Moreover, as there is a tendency among people not to check the old posts, the traffic for them decreases constantly.
Random Posts feature, in this case, can be an excellent solution for overcoming WordPress’s built-in reverse order.
In this blog post, you will learn details about:
- How to display random posts on your site
- The best random post plugin
- Why showing random posts benefits you
- The way to show random posts without a plugin
So, without any further ado, let’s get started!
What Are Random Posts in WordPress?
Random posts are blog posts that are displayed in a non-sequential, unpredictable order on your website. Instead of showing the latest or most popular posts, random posts shuffle your content and show different articles each time a page loads or is refreshed.
Examples of Random Posts:
- A widget showing 3 random blog posts in your sidebar
- A “You Might Also Like” section that displays random content each time
- A homepage section that showcases hidden gems from your blog archives
This is particularly helpful if you have many posts on your website and want to increase visibility for them.
Random Post vs. Related Post vs. Recent Post
If you own a WordPress blog website, you should know the difference between a random post, a related post, and a recent post. They may seem similar, but they serve different purposes.
Let’s learn about them in detail:
🔀 Random Posts
These are posts shown in no particular order. Each time someone visits your site or refreshes the page, they see a different set of articles. The posts are shown randomly and don’t depend on post date or content.
Use case: Great for increasing traffic to your old blog posts.
🔗 Related Posts
These are based on the content of the page a visitor is currently reading. Related posts are usually from the same category, tags, or similar keywords. Many plugins use advanced algorithms or manual rules to display them.
Use case: Increasing user engagement and dwell time on your website.
🕒 Recent Posts
These are the posts you have recently published. This is the default way WordPress displays posts on your website – in reverse chronological order (newest first). Normally, you will find these posts in sidebars or homepages to highlight your most up-to-date content.
Use case: Ideal for news sites, active blogs, or any website where timely content matters.
So, what is the key difference?
Random Posts = Offers variety and unpredictability
Related Posts = Provides context and relevance
Recent Posts = Provides freshness and updates
All three types have different purposes. In this post, we will deep dive into the random posts and why they are important for your website.
How to Show Random Posts in WordPress without Plugins
Want to display random posts on your site without installing a plugin? You can easily do that using a simple PHP snippet.
It’s a great way to show dynamic content in places like your single blog posts.
✅ Prerequisites (Before You Add the Code)
You can simply copy and paste the code into your theme’s files, but I recommend going through these prerequisites. Simply follow these steps:
Use a Child Theme: Always make changes in a child theme to avoid losing them during theme updates.
How to Create One: You can use a plugin like Child Theme Configurator, or manually create a folder in /wp-content/themes/, add a style.css and functions.php file, and set the template to match your parent theme.
Here’s a helpful video tutorial on how to create a child theme easily:
Custom Code to Display Random Posts
<?php
// WPXPO - Show 5 random posts
$args = array(
'post_type' => 'post',
'orderby' => 'rand',
'posts_per_page' => 5,
);
$wpxpo_random = new WP_Query($args);
if ($wpxpo_random->have_posts()) {
echo '<ul class="wpxpo-random-posts">';
while ($wpxpo_random->have_posts()) {
$wpxpo_random->the_post();
echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
}
echo '</ul>';
wp_reset_postdata();
}
?>
Where to Place This Code (Example: Single Posts)
For instance, if you want to show random posts at the bottom of each blog post:
- Open your child theme’s single.php file.
- Scroll to the bottom and find the line that says get_footer();.
- Paste the code just above that line to display the random posts below your blog content.
How to Display Random Posts Using A Plugin [Recommended Method]
To display random posts easily with enhanced customization options, you should use a dedicated plugin solution. PostX is an advanced Gutenberg blocks plugin that offers the functionality of showing random posts.
In this section, I will provide the step-by-step guide you can get started with displaying randomized posts.
Step 1: Install and Activate the PostX Plugin
Firstly, you will need to install and activate the PostX plugin. The installation procedure is similar to any other plugin. Simply follow these steps:
- Go to your WordPress Dashboard.
- Navigate to Plugins → Add New.
- Search for PostX.
- Click Install Now and then Activate.
Step 2: Add a Post Grid or List Block
PostX offers several layout blocks for displaying posts. You will need to add one such post block to your selected page. Here’s how to do it:

- Create a new page or edit an existing one using the WordPress block editor.
- Click the + icon to add a block.
- Choose a PostX post block such as Post Grid, Post List, or Post Slider.
- From the settings on the right, select your preferred layout for the block
Step 3: Enable Random Posts Order from the Query Settings
Now, scroll down this settings panel and you will see the Query Loop section. Here, select the Quick Query dropdown and from the list of options, you should see:
- Random Posts
- Random Posts (7 Days)
- Random Posts (30 days)

If you want to show posts from all time, simply choose Random Posts. If you want to display from the last 7 days or 30 days, you can set the corresponding options.
Step 4: Customize the Design (Optional)
You are almost done. But you can further customize the random posts with advanced settings from PostX. You can make your random post section stand out with custom styles.

- Use layout options like column count, column gap, and row gap.
- Enable the advanced pagination option
- Adjust title, image, post meta, excerpt, and more.
Step 5: Publish or Update Your Page
Finally, if you are satisfied with the customizations, click the Publish or Save button to see the changes in effect.
Now, visit your page and refresh it. You should see a random posts section, which will show different posts every time users reload the page.
Can I Show Random Blog Posts From A Specific Category?
Yes, you can show random blog posts from a specific category using the PostX plugin.
For example, suppose you have a movie review site. Your blog posts are divided into 5 categories: Action, Thriller, Drama, Horror, and Fiction.
If you want to show random Action and Drama posts on a page, you can easily do it with PostX.

Here are the detailed steps:
- First, go to the blocks settings option.
- Click on Query Loop > Quick Query.
- You find a Taxonomy option below. Here, select Category.
- Then select your desired category in Taxonomy Value.
- Finally, from the Quick Query option, select Random Posts.
And users should see random posts from your chosen category whenever they visit your webpages.
Is It Possible To Show Random Posts On My WordPress Homepage?
You can easily display random posts on your home page, archive pages, or in a sidebar with the PostX plugin.
Well, let’s see how you can display random posts on a homepage:
- Go to the edit view of the homepage.
- Click on the plus (+) icon.
- Choose your desired PostX Blocks.
- Go to the settings option on the right-hand sidebar.
- Scroll down and find Query Loop > Quick Query.
- From the dropdown, select Random Posts.
You are all set now. Similarly, you can display random posts on the archive pages.
You will get more useful features with the PostX query builder, such as popular posts, related posts, and featured posts.
How Can I Display Random Posts Widget in WordPress
Displaying WordPress random post widget in the sidebar can be a good practice to attract visitors and increase traffic to all posts. With the help of PostX, you can easily display WordPress Random Posts widgets.
- From your WordPress Dashboard, Go to Appearance → Widgets.
- Add Gutenberg Blocks of PostX, for example, Post List #1 or any other as per your wish.

In the settings option, you will have a lot of customization options available. You can customize the block as per your needs and demands.
- Find the Quick Query option in the Query Loop setting section
- From the dropdown list, select Random Posts.
Why Should You Display Random Posts on Your Website?
Adding random posts to your site is not just a fancy trick. It actually benefits your site in numerous ways. Here are the main reasons you should implement it on your website.
🔁 Boosts User Engagement
Random posts catch your visitors’ attention by showing them something interesting or unexpected, each time they visit or reload the page.
People love variety. Seeing different posts each time makes your site feel fresh and dynamic.
Engagement increased. As visitors explore more content, they naturally spend more time on your site.
And if they find the randomly suggested blog posts helpful, they are more likely to come back to your website again.
📈 Increases Pageviews
Every extra page a visitor views adds value, especially if you’re monetizing your site through ads or affiliate content. Not to mention, it also increases the conversion rate.
- Old posts get new visibility. Even articles from years ago can start getting traffic again.
- Evergreen content performs well. If your content isn’t time-sensitive, showing it randomly gives it consistent pageviews.
- More clicks, more impressions. More variety = more chances to attract attention for your products.
🔽 Reduces Bounce Rate
People are visiting your website but not taking any action (such as reading blog post or browsing pages) can be frustrating.
Random posts provide a way for your potential customers to spend more time on your site – leading to reduced bounce rate.
You can think of random posts as a soft call-to-action: they gently invite readers to keep exploring without feeling pushy.
🔍 Helps with Content Discovery
You probably have great content that just isn’t getting the visibility it deserves. Random posts can fix that.
Relive the forgotten content: Posts that aren’t ranking on Google or linked in your menus can get a second chance.
Better User Experience: Visitors will feel like there’s always more to discover, which improves the experience when they visit your site.
In short, random posts help you make full use of your content library. They help you turn your blogging efforts into real outcomes.
Frequently Asked Questions
Is There Any Built-in Feature to Display Random Posts in WordPress?
No. You will not get any built-in feature to display random posts in WordPress. Also, you need to do coding, or you can easily display random posts with the PostX plugin.
Is There Any Chance to Decrease Traffic on My Recent Posts After Displaying them in the Random Posts Feature?
No, there is no such possibility as your new and old posts will be displayed randomly on the top of your site. Moreover, suppose you want to highlight any particular post after applying the random posts feature. In that case, you can do it by using the sticky posts feature.
How to Show Random Related Posts In WordPress?
You can easily show random related posts using the PostX plugin. PostX comes with a built-in Query Loop feature that allows you to display posts by category or tag, and you can also set the order to random for each block. Just add a Post Grid or List block offered by PostX to your preferred page, select taxonomy (like categories or tags), and change the order setting to Random in the query settings. This way, you can easily show related posts that are also randomly organized.
Want to Learn More on Posts Arrangement in WordPress? Check These Out!
✨ Effective Ways to Reorder Posts in WordPress
✨ How to Make Sticky Posts in WordPress Easily
✨ Introducing the PostX WordPress Query Builder
Conclusion
Finally, from the above-mentioned discussion, you will learn how to display WordPress random posts. If you have any more queries, feel free to comment below. PostX support team is always ready to help you.
Get PostX Pro to unlock all exciting features and make amazing Websites