Would you like to show your visitors the last blog posts that they viewed?
Many online shopping sites use cookies to display recently viewed items to their users. This helps keep users interested and builds brand recognition. You can do the same thing with the blog posts on your WordPress site.
In this article, we’ll show you how to display the last visited posts to a user in WordPress.
Why Display Last Visited Posts in WordPress?
Visitors to your WordPress blog will often be looking for your latest posts. Making it easy to find fresh content will improve user experience and increase page views. That’s why we usually recommend that you display your recent posts and most popular posts.
However, your users may sometimes come back to your 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 use cookies so they can display recently viewed items even when their users are not logged in.
You can do the same thing on your WordPress blog, helping your returning visitors to continue where they left off on their last visit.
Let’s have a look at how you can display a personalized list of the last posts that were visited by a user in WordPress.
How to Display Last Visited Posts in WordPress
The first thing you need to do is to install and activate the Last Viewed Posts plugin. For more details, see our step by step guide on how to install a WordPress plugin.
After activating the plugin, go to Appearance » Widgets. You need to click the plus + icon at the top of the screen to add a new widget, and then search the list for ‘Last Viewed Posts’. After that, simply drag the ‘Last Viewed Posts Redo’ widget to your sidebar.
Once you click the ‘Update’ button at the top of the screen, you can visit your website to see the list of last visited posts. These will only be visible if you have viewed posts on your blog after installing the plugin.
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 the performance of your website.
Because the plugin uses cookies, you may need to obtain user consent in order 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.
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 last visited posts to a user in WordPress. You may also want to learn how to create an email newsletter the right way, or check out our list of must have plugins to grow your site.
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.
Paolo says
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 says
For the moment that is correct.
Admin
Suyash Ekhande says
Any new plugins to show recently viewed post in a carousel format?.
Jordan Smith says
Is this plugin still maintained? I’m looking for this exact functionality. Thanks!
Matthew Dalli says
Is there a way to do this to have it highlighted next to the post title rather than in a widget?
kalico says
This is a fantastic little gem. Is there a way to make this display other (custom) post types, or history across a multisite network?
Brian says
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!
tony roberts says
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
RA says
Is there a shortcode for this plug in? I would like to insert this within a post.
WPBeginner Support says
No currently it does not have a shortcode. However, you can try our tutorial on how to add WordPress widgets in posts or page content.
Admin
frebro says
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?
musa garip says
Hi this plugin is great i have a questions
can you add a image ( featured image )
thanks
Editorial Staff says
Yes, but you would have to edit the plugin file.
Admin
David Rwell says
Thank you for this lovely little plug-in. It greatly adds to the personalization experience on a site.
David.
Jacopo Tarantino says
Is the plugin on github? I’d love to contribute.
Editorial Staff says
No it is not on Github yet. Please get in touch via the contact form, so we can communicate further
Admin
Jacopo Tarantino says
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 says
Agreed. That is in the list of things to add to that plugin when we create a settings page
Admin