I would like the categories menu to appear as a drop-down in both the list mode and grid mode view of the Wordpress media library. As of now, it only appears as a drop-down in list mode.

List Mode - Correct (categories appear as drop-down):

List Mode

Grid Mode - Incorrect (categories appear as text field):

Grid Mode

Here is the code I'm using in functions.php, which does work. I'm just not sure how to force the drop-down appearance in both view modes:

function add_categories_to_attachments() {
    register_taxonomy_for_object_type( 'category', 'attachment' );
add_action( 'init' , 'add_categories_to_attachments' );
  • Can you ellaborate further what you mean by "grid mode"? – Tom J Nowell Dec 17 '18 at 3:39
  • @TomJNowell OP is referring to the media library's grid view which can be toggled using the bar at the top left of the media library when viewing all media. For some reason, when this view was implemented, the devs didn't incorporate the standard categories meta box into the backbone template, and instead displayed the categories UI as a simple text box with comma separated IDs. – Dave Romsey Dec 17 '18 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.