Last Viewed Posts by WPBeginner

Description

Installing this will allow you to use a widget or template tag to show your site’s visitors a personalized list of posts and pages they have viewed.

The list of posts is saved in each visitor’s web browser, so even if you get millions of visitors a month it won’t affect the performance of your website.

Note: It doesn’t store a global list of recently viewed posts by all users. Nothing is stored in your site’s database. Every visitor has a custom lists of posts and pages they have viewed.

If JavaScript is disabled or no single post has been clicked, no output will be displayed.

The plugin comes with a widget and a template tag.

This plugin has been adopted and maintained by WPBeginner

What’s Next?

To learn more about WordPress, you can visit WPBeginner for tutorials on topics like:

…and many more WordPress tutorials.

If you like our Missed Scheduled Posts Publisher plugin, then consider checking out our other projects:

  • OptinMonster – Get More Email Subscribers with the most popular conversion optimization plugin for WordPress.
  • WPForms – #1 drag & drop online form builder for WordPress (trusted by 4 million sites).
  • MonsterInsights – See the Stats that Matter and Grow Your Business with Confidence. Best Google Analytics Plugin for WordPress.
  • SeedProd – Create beautiful landing pages with our powerful drag & drop landing page builder.
  • WP Mail SMTP – Improve email deliverability for your contact form with the most popular SMTP plugin for WordPress.
  • RafflePress – Best WordPress giveaway and contest plugin to grow traffic and social followers.
  • Smash Balloon – #1 social feeds plugin for WordPress – display social media content in WordPress without code.
  • AIOSEO – the original WordPress SEO plugin to help you rank higher in search results (trusted by over 2 million sites).
  • PushEngage – Connect with visitors after they leave your website with the leading web push notification plugin.
  • TrustPulse – Add real-time social proof notifications to boost your store conversions by up to 15%.

Visit WPBeginner to learn from our WordPress Tutorials and find out about other best WordPress plugins.

Installation

Viewed posts are always tracked as long as the plugin is active and the visitor has enabled JavaScript and local storage.

  1. Install Last Viewed Posts by uploading the last-viewed-posts directory to the /wp-content/plugins/ directory. (See instructions on how to install a WordPress plugin.)
  2. Activate Last Viewed Posts through the Plugins menu in WordPress.

To display the list, you can use the widget that comes with the plugin, or use the following code and place it anywhere you want to outside the loop, e.g. sidebar.php :

<?php if (function_exists('zg_recently_viewed')): ?>
    <h2>Last viewed posts</h2>
    <?php zg_recently_viewed(); ?>
<?php endif; ?>

Reviews

January 2, 2020
Several issues with this plugin. Great idea, but too many errors: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in last_viewed_posts.php on line 64, or like Cannot modify header information - headers already sent by last_viewed_posts.php on line 87, etc.
Read all 2 reviews

Contributors & Developers

“Last Viewed Posts by WPBeginner” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • Complete rewrite to use JavaScript rather than cookies to store custom posts.
  • Updated list of supported WordPress versions.
  • Improved performance for sites with a large number of visitors.

0.7.3

  • Updated Readme.txt.
  • Checked compatibility with WordPress 5.1.1.
  • Miscellaneous updates.

0.7.2

  • Plugin maintainance update.

0.7.1

  • Post/Page ID values in cookie are sanitized for output. Upgrade is recommend for more security.

0.7

  • Pages can now be recognized (optional).
  • Custom Loop is not longer used. Now we make a database query to get the post title.