Archive widget – limit number of months to 12

Use the widget_archives_args filter to add the archives limit.

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

And to limit the number of months in Archives widget dropdown use the following drop down filter.

add_filter( 'widget_archives_dropdown_args', 'my_limit_archives' );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)