Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BruceMcKinnon/b82856f5b0c35526dfc2f2f51e5cbdd7 to your computer and use it in GitHub Desktop.
Save BruceMcKinnon/b82856f5b0c35526dfc2f2f51e5cbdd7 to your computer and use it in GitHub Desktop.
WP add categories and tags for attachments and media objects
//
// 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
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