Created
March 19, 2016 14:06
-
-
Save damianwajer/fffa7863a7ffdf17f5e0 to your computer and use it in GitHub Desktop.
[WordPress] How to add media categories
This file contains hidden or 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
<?php | |
/** | |
* Taxonomy for media files. | |
*/ | |
function init_media_categories() { | |
register_taxonomy( 'media_cat', 'attachment', array( | |
'label' => __( 'Categories' ), | |
'hierarchical' => true, | |
'public' => false, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'update_count_callback' => '_update_generic_term_count', | |
'rewrite' => array( 'slug' => 'media-category' ), | |
) ); | |
} | |
add_action( 'init', 'init_media_categories' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment