Created
September 7, 2017 22:49
-
-
Save codytooker/ef652549202b9df3bcea13a2333d75b2 to your computer and use it in GitHub Desktop.
US States to insert into a Wordpress Taxonomy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$states = array( | |
'Alabama', | |
'Alaska', | |
'Arizona', | |
'Arkansas', | |
'California', | |
'Colorado', | |
'Connecticut', | |
'Delaware', | |
'District of Columbia', | |
'Florida', | |
'Georgia', | |
'Hawaii', | |
'Idaho', | |
'Illinois', | |
'Indiana', | |
'Iowa', | |
'Kansas', | |
'Kentucky', | |
'Louisiana', | |
'Maine', | |
'Maryland', | |
'Massachusetts', | |
'Michigan', | |
'Minnesota', | |
'Mississippi', | |
'Missouri', | |
'Montana', | |
'Nebraska', | |
'Nevada', | |
'New Hampshire', | |
'New Jersey', | |
'New Mexico', | |
'New York', | |
'North Carolina', | |
'North Dakota', | |
'Ohio', | |
'Oklahoma', | |
'Oregon', | |
'Pennsylvania', | |
'Rhode Island', | |
'South Carolina', | |
'South Dakota', | |
'Tennessee', | |
'Texas', | |
'Utah', | |
'Vermont', | |
'Virginia', | |
'Washington', | |
'West Virginia', | |
'Wisconsin', | |
'Wyoming', | |
); | |
//The Taxonomy to insert the states into | |
$taxonomy = 'state'; | |
//default args | |
$args = array(); | |
foreach ($states as $state) { | |
wp_insert_term($state, $taxonomy, $args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment