Hi Mikko,
Thank you for replying to my question so quickly, appreciate it. Unfortunately, I’m brand new to PHP and can’t quite get this to work.
Do I have to specify all the values you added to the array (taxonomy slug, terms, and taxonomy term slug)? Or will one of the values be sufficient, for example just the taxonomy slug?
I know what a taxonomy slug is but I’m not quite sure what the ‘terms’ or ‘taxonomy term slug’ is.
Would you be able to provide an example (for a newbie!) based off the code I used to register my taxonomy? If so, it is below. Thanks!
function add_trainers_taxonomies() {
// Add new "trainers" taxonomy to Pages
register_taxonomy('trainers', 'page', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Personal Trainers', 'taxonomy general name' ),
'singular_name' => _x( 'Location', 'taxonomy singular name' ),
'search_items' => __( 'Search Locations' ),
'all_items' => __( 'All Locations' ),
'parent_item' => __( 'Parent Location' ),
'parent_item_colon' => __( 'Parent Location:' ),
'edit_item' => __( 'Edit Location' ),
'update_item' => __( 'Update Location' ),
'add_new_item' => __( 'Add New Location' ),
'new_item_name' => __( 'New Location Name' ),
'menu_name' => __( 'Personal Trainers' ),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'personal-trainers', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/locations/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}
add_action( 'init', 'add_trainers_taxonomies', 0 );
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]