Blog

WordPress

Posted on — Last updated on August 16, 2024

How To Migrate From the Classic WordPress Popular Posts Widget to the WPP Block or the WPP Shortcode

A short guide to help you move from the classic widget into more up-to-date alternatives / replacements

The classic WordPress Popular Posts widget is no more (here’s why).

The “classic” WordPress Popular Posts widget was deprecated on June 2023 and on June 2024, a year later, it was officially removed from the plugin. This migration guide has been written in hopes that it’ll help you move from the “classic” WordPress Popular Posts widget into either the WordPress Popular Posts block (if your theme supports blocks) or the [wpp] shortcode.

In case you’re not sure which one to switch to:

Alright, let’s get started.


Replacing the “classic” WordPress Popular Posts widget with the WordPress Popular Posts block

This should be straightforward since the WordPress Popular Posts block is the direct replacement of the “classic” WordPress Popular Posts widget, hopefully everything should feel familiar.

  1. Go to Appearance > Widgets > [Your site’s sidebar] and add a WordPress Popular Posts block (see How to use blocks in the Widget Editor for more details.)
  2. Use the same settings from the “classic” WordPress Popular Posts widget on the WordPress Popular Posts block.
  3. Click on the Update button to save changes.

If everything went well delete the “classic” WordPress Popular Posts widget from your sidebar.


Replacing the “classic” WordPress Popular Posts widget with the [wpp] shortcode

Screenshot of the auto-generated shortcode

  1. Go to Appearance > Widgets > [Your Sidebar] > WordPress Popular Posts and copy the shortcode that you’ll find in there (note that said shortcode will appear only if you’re using WordPress Popular Posts 7.0.x or newer.)
  2. Add a Custom HTML widget right below your old Popular Posts one.
  3. Set a title for your Custom HTML widget (eg. Popular Posts.)
  4. Paste the [wpp] shortcode you copied earlier from the classic widget into the Custom HTML widget. If you want or need to make any kind of adjustments to the shortcode refer to Parameters for documentation and examples.
  5. Save changes.
  6. Add the following PHP code snippet to your site either via your theme’s functions.php or via the Code Snippets plugin for example:
    add_filter( 'widget_text', 'do_shortcode' );

If you’re using a theme with your popular posts list (eg. Cards) you’ll want to copy over its CSS rules as well (see How to Easily Add Custom CSS to Your WordPress Site by WP Beginner for a full walk-through.)

Here you can find the CSS rules for every widget theme:

Once you’re satisfied with the way the shortcode looks on your sidebar delete the “classic” WordPress Popular Posts widget from your sidebar.


Questions? Observations? Leave a comment below!