Skip to content

Instantly share code, notes, and snippets.

@infn8
Last active January 3, 2016 16:09
Show Gist options
  • Save infn8/8487698 to your computer and use it in GitHub Desktop.
Save infn8/8487698 to your computer and use it in GitHub Desktop.
Add categories to your WordPress Images
<?php
// Begin Copy into functions.php
function image_category() {
$labels = array(
'name' => 'Image Categories',
'singular_name' => 'Image Category',
'menu_name' => 'Image Categories',
'all_items' => 'All Image Categories',
'parent_item' => 'Parent Image Category',
'parent_item_colon' => 'Parent Image Category:',
'new_item_name' => 'New Image Category Name',
'add_new_item' => 'Add New Image Category',
'edit_item' => 'Edit Image Category',
'update_item' => 'Update Image Category',
'separate_items_with_commas' => 'Separate Image Categories with commas',
'search_items' => 'Search Image Categories',
'add_or_remove_items' => 'Add or remove Image Categories',
'choose_from_most_used' => 'Choose from the most used Image Categories',
'not_found' => 'Image Category Not Found',
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => false,
'show_tagcloud' => false,
'rewrite' => false,
);
register_taxonomy( 'image_category', 'attachment', $args );
}
// End Copy
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment