How to Show Random Posts in WordPress?

In this article, we are going to talk about the process of displaying random posts on the WordPress homepage.

By default, the latest published posts are displayed on the homepage. However, if you have a blog with a lot of content, it becomes necessary to keep the old content visible, and this can only happen if random posts, by automatic selection, are displayed on the homepage or the sidebar or the footer.

This way the people visiting your blog would click on the random posts and read the old content. The bounce rate will decrease, and the viewership will increase.

If you are running a new site or a site with multiple authors, which leads to an increase in the number of daily publications, it becomes necessary to keep the content interesting, and one way is to push the old content to the forefront.

There are a lot of ways through which you can display the random posts on the WordPress site. We will explore some of the methods in the following paragraphs.

Displaying Random Posts in WordPress

The methods are:

1 Advanced Random Posts Widget

The Advanced, Random Posts Widget plugin, works by displaying random posts on your sidebar. Once installed, it adds the advanced random posts widget on the dashboard. Specifically, there are six tabs, which are General, Posts, Taxonomy, Thumbnail, Extras, and Custom CSS.

In the General settings tab, you can add the basics such as the title, the title URL, and custom HTML before and after the post content. You can add a custom CSS class as well.

In the Posts tab, classify the nature of posts to display. You can choose to ignore sticky posts, determine the number of posts to display in the sidebar, nature of posts, and the status of the posts.


In the Taxonomy tab, simplify the content selection choice by selecting a specific category and tags. The plugin will automatically select posts from the determined category and display it on the sidebar.

In the Thumbnail tab, choose whether you want to display an image along with the post title or not. Activate the option to display the thumbnail, choose the thumbnail size, width and height, and the thumbnail alignment.

In the Extras tab, there are additional settings such as choosing the length of the post excerpt to display, display date, modified date display, and other relative date choices.

In the Custom CSS section, you can add CSS code to modify how the widget looks on the front end. Leave it blank if you don’t have any idea about CSS coding.

2. Navigation Menu Display

You can also add specific random posts on the primary navigation menu. Often, we write and publish evergreen cornerstone content which deserves more views than other content pieces. Such posts can be identified and displayed on the forefront through the navigation menu hack.


You have to create the “Random Post” button and add it to the navigation menu like seen below.

Add this code in the function.php file and save it.

The code creates the button/link with the random content. The next step is to add the newly created function to the navigation menu. Add the following code to the function.php file.

Every time anyone clicks on the button, the person is directed to any random post.

Note: If you’re unsure about modifying the functions.php file, read about add the same to a site specific plugin.


These are two primary methods to display random posts in WordPress. Before you use any of these methods, explore the existing WordPress theme you’re using as these days, most of the high-end themes come with a method to display random posts below the published content. If such a feature is available, you won’t need to use either of the above methods.

How to Show Random Posts in WordPress?
3 (60%) 2 votes