PHP WordPress - Register Custom Taxonomy with Attachment

// register new taxonomy which applies to attachments function wptp_add_location_taxonomy() { $labels = array( 'name' => 'Locations', 'singular_name' => 'Location', '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' => 'Location', ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'query_var' => 'true', 'rewrite' => 'true', 'show_admin_column' => 'true', ); register_taxonomy( 'location', array( 'attachment' ), $args ); } add_action( 'init', 'wptp_add_location_taxonomy' );

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.