Unexpected warning message to my WordPress posts which group and listed out by year
The issue is here: if($year !== $year_check){ The first time that conditional is used in the loop – $year_check has not been defined. The solution is to simply define it before this: <?php if( have_posts() ) : ?> For example: <?php $year_check = 0; ?> <?php if( have_posts() ) : ?>