Shortcode not working in Jetpack Top Posts & Pages widget

I've added [year] shortcode to some of my posts' titles.

I used this in functions.php to enable this shortcode:

add_shortcode( 'year' , 'current_year' );
function current_year() {
    $year = date(Y);
    return $year;
}

I then added this too to enable shortcodes in widgets:

add_filter( 'widget_text', 'do_shortcode' );

But the shortcode doesn't work in the post titles list shown by Top Posts Pages widget by Jetpack.

How do I fix it?

Topic plugin-jetpack shortcode Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.