Retrieve Last Year Archives Only

This snippet retrieves and echoes only last year archives. It could be useful if you want to make collapsing/expanding archives by year.

Just inserts this snippet in your theme where you want to display archives.
You might want to tune the wp_get_archives options as you want!

function filter_last_year_archives($where_clause) {
	$year = date('Y') - 1;
    	return $where_clause." AND post_date LIKE '%".$year."%'";

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!