Add taxonomy to image in WordPress

From wp 3.5 there’s the possibility to add taxonomy support for attachment post type.
Is a simple but great feature, this is the example code to do that:

add_action('admin_init', 'reg_tax');
function reg_tax() {
register_taxonomy_for_object_type('category', 'attachment');
add_post_type_support('attachment', 'category');

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *