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:
- If you can use blocks on your site then switch to the WordPress Popular Posts block (this is the recommended option, it’s easier to set up and use than the shortcode in general.)
- If you can’t or don’t want to use blocks (eg. the Classic Widgets plugin is installed on your site) then switch to the [wpp] shortcode.
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.
- 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.)
- Use the same settings from the “classic” WordPress Popular Posts widget on the WordPress Popular Posts block.
- 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
- 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.)
- Add a Custom HTML widget right below your old Popular Posts one.
- Set a title for your Custom HTML widget (eg. Popular Posts.)
- 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.
- Save changes.
- 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!