Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Show Last Visited Posts in WordPress (Beginner’s Guide)

Showing visitors the last blog posts they viewed can improve their experience on your website.

Many online shopping sites use cookies to display recently viewed items to keep users engaged and build brand recognition.

You can apply the same technique to your WordPress blog posts. This will help keep your visitors interested and make it easier for them to find content they like.

In this article, we will teach you how to display the last visited posts to a user in WordPress. With a few simple steps, you can make your site more user-friendly and engaging.

How to Display Last Visited Posts to a User in WordPress

Why Display Last Visited Posts in WordPress?

People may sometimes return to a blog to revisit a post they have already read.

Websites like Amazon realize this and show visitors recently viewed items to boost sales and increase user engagement. They also use cookies to display recently viewed items even when users are not logged in.

You can do the same thing on your WordPress blog. This can help your returning visitors to continue where they left off on their last visit.

Let’s look at how you can display a personalized list of the last posts a user visited in WordPress.

Hi, there! Just a quick note: The method covered in this article works best with classic themes. If you’re using a block-based WordPress theme, then some steps may not apply.

How to Display Last Visited Posts in WordPress

The first thing you need to do is install and activate the Last Viewed Posts plugin.

If you need help, you can see our step-by-step guide on how to install a WordPress plugin.

After activating the plugin, you’ll want to go to Appearance » Widgets. Then, click the plus ‘+’ icon at the top of the screen to add a new widget and search the list for ‘Last Viewed Posts Redo.’

Once you do that, simply drag the ‘Last Viewed Posts Redo’ widget to the sidebar area.

Add the Last Viewed Posts Redo Widget

And that’s it! After clicking the ‘Update’ button at the top of the screen, you can visit your website to see the list of posts you last visited.

Please note that the ‘Last Viewed Posts’ list will only be visible if you have viewed posts on your blog after installing the plugin.

Preview of Last Viewed Posts

Note: Visitors to a WordPress blog might also look for the latest or most popular posts to stay updated or find recommended content. Making this content easy to find can improve the user experience and increase page views.

For more details on this topic, you can see our guide on displaying recent posts or the most popular posts.

Disclosing That the Plugin Uses Cookies

The Last Viewed Posts plugin does not store the list of recently viewed posts for each user on your website.

Instead, the list of posts is saved in each visitor’s web browser, so it won’t affect your website’s performance.

Because the plugin uses cookies, you may need to obtain user consent to comply with the GDPR.

You can learn how to do that by following our guide on how to add a cookies popup in WordPress for GDPR/CCPA.

Cookie notice default message

If a user decides not to allow cookies from your blog, then the list of last visited posts will not be displayed.

We hope this tutorial helped you learn how to display the last visited posts to a user in WordPress. Next, you may also want to learn how to add featured posts in the WordPress sidebar or check out our best related posts plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

19 CommentsLeave a Reply

  1. kzain

    One idea I’d like to add is combining this with a “Related Posts” widget. By showing users their last visited post along with similar content, it could encourage them to stay on the site longer and explore more.

  2. Paolo

    Hi, just to be sure, by using cookies that means that if a user will change browser , he/she won’t be able to find the list of previously read posts, is that correct?

    • WPBeginner Support

      For the moment that is correct.

      Admin

  3. Suyash Ekhande

    Any new plugins to show recently viewed post in a carousel format?.

  4. Jordan Smith

    Is this plugin still maintained? I’m looking for this exact functionality. Thanks!

  5. Matthew Dalli

    Is there a way to do this to have it highlighted next to the post title rather than in a widget?

  6. kalico

    This is a fantastic little gem. Is there a way to make this display other (custom) post types, or history across a multisite network?

  7. Brian

    Is there a way to show the whole post (i.e. get_post) instead of just the title? Would you be able to provide the code and the location or where to place it in the plugin code? Thanks!

  8. tony roberts

    I have installed the plugin but have trouble installing the widget. Go to Appearance > Widgets > Click on Last Viewed Posts> Click Primary Sidebar>Add Widget, nothing happens. If I drag and drop the Last Viewed Posts still nothing happens.

    Any idea what I’m doing wrong?

    Tony

  9. RA

    Is there a shortcode for this plug in? I would like to insert this within a post.

  10. frebro

    This works nicely on my localhost but throws a “Cannot modify header information – headers already sent” error on the production server. Seems like content has already begun to output when you set the cookie.

    I’m using Roots theme and Wordpress 3.6. Any suggestions on how to solve this?

  11. musa garip

    Hi this plugin is great i have a questions

    can you add a image ( featured image )
    thanks

  12. David Rwell

    Thank you for this lovely little plug-in. It greatly adds to the personalization experience on a site.

    David.

  13. Jacopo Tarantino

    Is the plugin on github? I’d love to contribute.

    • Editorial Staff

      No it is not on Github yet. Please get in touch via the contact form, so we can communicate further :)

      Admin

  14. Jacopo Tarantino

    Wouldn’t it be better to use some kind of override in your own theme or plugin to change the value of those variables? If you edit the plugin directly, when you update the plugin(which you should always do!) you’ll lose those changes. It shouldn’t be too hard to hook in right after the plugin is activated and assign new values to what I’m assuming are global variables.

    • Editorial Staff

      Agreed. That is in the list of things to add to that plugin when we create a settings page :)

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.