Running a long-term WordPress blog? Your archive widget can quickly become overwhelming with years of monthly links. As experienced WordPress users ourselves, we've streamlined countless sites. Here's how to limit the number of archive months shown, keeping your sidebar clean and user-friendly.

Subscribe to WPBeginner for more tips. Prefer reading? Scroll on for detailed steps.
This user-friendly approach collapses archives into expandable sections—perfect for any skill level.
Install and activate the Collapsible Archives plugin. See our step-by-step plugin installation guide for details.
Head to Appearance » Widgets and drag the Collapsible Archives widget to your sidebar.

The widget expands with customizable options. It uses JavaScript to group links by year (expandable to months, even post titles). Tweak settings to fit your site, then hit Save.
Preview your site—archives now collapse neatly.

For a modern, space-saving display without long lists.
Install and activate the Compact Archives plugin (plugin guide here).
Add the Compact Archives widget via Appearance » Widgets.

Choose from block, initials, or numeric styles. Save, then check your live site.

Bonus: Use it for a custom archives page. Details in our Compact Archives guide.
For developers: Precisely control via code. Backup first and follow our code editing guide.
Add this to your theme's functions.php or a site-specific plugin:
function wpb_limit_archives() {
$my_archives = wp_get_archives( array(
'type' => 'monthly',
'limit' => 6,
'echo' => 0
) );
return $my_archives;
}
add_shortcode( 'wpb_custom_archives', 'wpb_limit_archives' );
add_filter( 'widget_text', 'do_shortcode' );This fetches the last 6 months, creates a shortcode, and enables it in text widgets.
In Appearance » Widgets, add a Text widget to your sidebar. Switch to Text mode and insert:
<ul>
[wpb_custom_archives]
</ul>Save and view your site—custom archives live.
Pro tip: Adjust 'limit' => 6 as needed.
That's it! Your archives are now concise. Explore more in our top functions.php hacks.
Liked this? Subscribe to our YouTube channel, follow on Twitter, or like on Facebook for WordPress expertise.