Try this, using this code.
import wixData from'wix-data';
$w.onReady(function(){
$w('#selectionTagsID').onChange(()=>{
const selectedTag =$w('#selectionTagsID').value;
let filter = wixData.filter();
if(selectedTag.length >0){
filter = filter.hasSome("FIELDKEY", selectedTag);
}
$w('#datasetID').setFilter(filter);
})
});
Here’s the tutorial step by step https://www.wix.com/velo/forum/tips-tutorials-examples/how-to-filter-wix-gallery-using-selection-tags