I've got a select dropdown which outputs all the available categories of the Wordpress site. Now I've been trying to also set the
value of each option to the category name. This is my code:
This works for a couple of categories such as "Uncategorised" but it doesn't work for categories with a space in them so for example "Case Study". For those categories it sets the value as
So it obviously seems to be an issue with the spaces but anybody got any idea how I can fix this?