Limit archives widget to display only 12 months

Adding this snippet to the functions.php of your wordpress theme will limit the archives widget to display only 12 months. Replace the add_filter from the first snippet with the second add_filter bellow so this snippet will work for the dropdown archives widget.

 

 

function my_limit_archives($args){
$args['limit'] = 12;
return $args;
}
add_filter( 'widget_archives_args', 'my_limit_archives' );

add_filter( 'widget_archives_dropdown_args', 'my_limit_archives' );

Leave a comment