I am creating a taxonomy filter for WordPress archives. I have the checkboxes working so when selected they redirect the page to the correct URL based on the taxonomy slug. My problem is that after page reload the checkbox state resets to unchecked.
Here is my code:
<?php
$workoutmoves = get_terms('Exercise-Types', array('hide_empty' => 0));
?>
<?php if ($workoutmoves): ?>
<h5>Show Me</h5>
<ul class="no-bullet">
<?php foreach($workoutmoves AS $workoutmove): ?>
<li>
<input class="check_box" type="checkbox" value="<?php echo $workoutmove->slug; ?>"><?php echo $workoutmove->name; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
I thought of adding a php if statement into the input field and echoing 'checked="checked"' but I don't know how to grab the correct data to identify if it should be set.
Any insights would be a huge help. Thanks.