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 una risposta

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *