How to get a list of all the years that have posts
I am not sure why you prefer the longer method over wp_get_archives(). I recommend letting WordPress do the work for you. It is more efficient, and easier to read. However … since you presented a particular preference: It would appear that you are using an array for post_type, when none is required. Try modifying your … Read more