Skip to content

Instantly share code, notes, and snippets.

@dannyconnolly
Created November 2, 2015 08:55
Show Gist options
  • Save dannyconnolly/e26f3d062849d48108c1 to your computer and use it in GitHub Desktop.
Save dannyconnolly/e26f3d062849d48108c1 to your computer and use it in GitHub Desktop.
Add taxonomies to worpress media attachments
/**
* add categories for attachments
*/
function add_categories_for_attachments() {
register_taxonomy_for_object_type('category', 'attachment');
}
add_action('init', 'add_categories_for_attachments');
/**
* add tags for attachments
*/
function add_tags_for_attachments() {
register_taxonomy_for_object_type('post_tag', 'attachment');
}
add_action('init', 'add_tags_for_attachments');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment