I thought this would be an easy endeavor, but it turned out complicated.
So I've an url with following gets:
?mt-make=ford&mt-model=fiesta
Form looks like this:
So when user clicks Trash icon, I want to unset _GET variable.
<?php foreach ( $_GET as $k => $v ) { ?>
<?php if ( $k == 'mt-vehicle' || empty( $v ) ) { continue; } ?>
<li class="mt-search-tags-list-item"><a href="#"><?php echo $v; ?> <span class="dashicons dashicons-trash"></span></a></li>
<?php } ?>
How would go about doing this?
I tried instead of link having a button with name="mt-make"
with empty value thinking it would overwrite _GET in the url - but it didn't! that was unexpected. Instead I got this ?mt-make=&mt-make=ford&mt-model=fiesta
notice double mt-make
!