Show previous month’s posts

This could be a simple PHP issue of how you are asking to return the first date()

date('M', mktime(0, 0, 0, date('m'), 0, date('Y')));

is returning Dec, and WP_Query needs the month number. First, try changing ‘M’ to ‘m’.

date('m', mktime(0, 0, 0, date('m'), 0, date('Y')));

If that doesn’t work, try using the date_query and pass the year in as well.

Good luck!

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