Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author jeffrey-wp

    (@jeffrey-wp)

    With my plugin this is not possible. If you want this then you have to program some additional code (ask your local website builder).

    Thread Starter iltdevunit

    (@iltdevunit)

    I managed to do it by adding this code to functions.php

    function hide_media_categories($query) {
    	global $pagenow;
    
       if( ( 'upload.php' != $pagenow   ) || !$query->is_admin ){
    		return $query;
    	}
    
       $tax_query = array(
          array(
            'taxonomy' => 'media_category',
            'field' => 'id',
            'terms' => array(177),
            'operator' => 'NOT IN'
          )
       );
    
       $query->set( 'tax_query', $tax_query );
    }
    add_filter('pre_get_posts', 'hide_media_categories');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude category from Media Library’ is closed to new replies.