Hi everyone! If you work with Advanced Custom Fields on a regular basis, you’ll often run into the need to populate your Select fields with values that your website admins can choose. One common thing I do is to have a state select drop down by building a select box, like this:
In case you didn’t know, you can populate the choices of your select dropdown using values and labels. Just specify “value : Label” and you will be good to go, as so:
Some wonderful soul made a list of US States for a select field for ACF. They posted this on the ACF support forums in 2014 and there has been a ton of traction ever since. I’m so thankful to whoever made this list and have used it many times. However, there’s one small change I’d like to make.
I prefer to keep my variable and value names lowercase, to avoid the trauma of case issues. It’s considered a clean programming thing to do, especially in PHP. So I’ve put together my own list—a list that is exactly the same, but lowercase. Enjoy!
al : Alabama ak : Alaska az : Arizona ar : Arkansas ca : California co : Colorado ct : Connecticut de : Delaware dc : District of Colombia fl : Florida ga : Georgia hi : Hawaii id : Idaho il : Illinois in : Indiana ia : Iowa ks : Kansas ky : Kentucky la : Louisiana me : Maine md : Maryland ma : Massachusetts mi : Michigan mn : Minnesota ms : Mississippi mo : Missouri mt : Montana ne : Nebraska nv : Nevada nh : New Hampshire nj : New Jersey nm : New Mexico ny : New York nc : North Carolina nd : North Dakota oh : Ohio ok : Oklahoma or : Oregon pa : Pennsylvania pr : Puerto Rico ri : Rhode Island sc : South Carolina sd : South Dakota tn : Tennessee tx : Texas ut : Utah vt : Vermont va : Virginia wa : Washington wv : West Virginia wi : Wisconsin wy : Wyoming