From the course: WordPress: Custom Post Types and Taxonomies

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Make location taxonomy

Solution: Make location taxonomy - WordPress Tutorial

From the course: WordPress: Custom Post Types and Taxonomies

Start my 1-month free trial

Solution: Make location taxonomy

(upbeat music) - [Instructor] Now that you've created a location taxonomy, let's take a look at how I would do it. Since we have our register size taxonomy function here, we're going to copy that and use it a boiler plate for our location taxonomy. We'll go ahead and paste that right into the register.php file inside our taxonomies folder. Then we'll rename this function to lil_register_location_taxonomy. We'll change the labels. So we'll change Sizes to Locations, we'll change Size to Location, and we'll change Add New Size to Add New Location. In the args is where it gets a little tricker because we want this taxonomy to be hierarchal. So the first thing we'll need to do is add the hierarchical key and we'll set that to true, it is false by default. And then we'll also set our rewrite rules. Because we are making this a hierarchical taxonomy we want to make sure we have the appropriate rewrite structure in place, so we'll set this array and there are two keys we're going to set…

Contents