Created
May 26, 2016 00:09
-
-
Save BruceMcKinnon/b82856f5b0c35526dfc2f2f51e5cbdd7 to your computer and use it in GitHub Desktop.
WP add categories and tags for attachments and media objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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