Skip to content

Instantly share code, notes, and snippets.

@StephenPunwasi
Created November 18, 2015 15:53
Show Gist options
  • Save StephenPunwasi/c222497a6d75bc4bd0c2 to your computer and use it in GitHub Desktop.
Save StephenPunwasi/c222497a6d75bc4bd0c2 to your computer and use it in GitHub Desktop.
Add Categories and Tags To Wordpress Attachments
// Add Categories To WordPress Attachments
add_action( 'init' , 'add_categories_for_attachments' );
function add_categories_for_attachments(){
register_taxonomy_for_object_type( 'category', 'attachment' );
}
// Add Tags To WordPress Attachments
add_action( 'init' , 'add_tags_for_attachments' );
function add_tags_for_attachments() {
register_taxonomy_for_object_type( 'post_tag', 'attachment' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment