List monthy archives for specific year with wp_get_archives


I just want a simple list with the monthly archives for one specific year. Like so:

  • January
  • February
  • March
  • April
  • etc.

I don’t need anything fancy like yearly grouping. Ideally I would like a shortcode like this [month-archive year=2019]. This is how far I’ve come but the ‘Year’ parameter does not seem to do anything.

function my_monthly_archives() { 

$my_archives = wp_get_archives(array(

return $my_archives; 


// Create a shortcode
add_shortcode('month-archive', 'my_monthly_archives'); 

// Enable shortcode execution in text widget
add_filter('widget_text', 'do_shortcode'); 
, , Josef Ulander 4 years 2020-03-28T20:50:58-05:00 0 Answers 115 views 0

Leave an answer