0

Saving Select Dropdown Value on Refresh in WordPress Search using PHP

There’s subtle things in UX that we seem to take for granted this applies to developers as well as users, here’s something so simple but makes a big difference in terms of a users experience. Have you ever gotten frustrated when you’ve used a Select Dropdown menu to search for something but once it’s submitted and the screen has refreshed it doesn’t save what you last searched for? Well here’s the answer to that very problem.

Using the below code snippet you’ll be able to generate a Select Dropdown from any number of Taxonomy Terms, the whole thing is dynamic too which means it can be used across multiple taxonomies, obviously your Search template and Search Form need to reflect this but hopefully it should be useful regardless.

It will ensure that whatever value (in this case Taxonomy Term) is passed to the Select Dropdown will be saved on refresh making the whole UX experience a bit more polished and informed.

0