How to loop custom posts that have an exact match in taxonomy terms?

You must use the || code

not &&
I also deleted this code that was wrong in your code

as ; in the PHP code opener

Code Like This :


        <div class="sc-age-group">
                <?php 
                     $agegroup = wp_get_post_terms(get_the_ID(), 'camper_grade');
                     if ($agegroup) {
                        foreach ($agegroup as $group) {
                            if ($group->name == "1st Grade" || $group->name == "2nd Grade") { ?>
                                <div class="sc-age-group_1-2">Grades 1-2</div> <?php 
                            }
                        }
                     }
                ?>
         </div>

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