diff --git a/src/media.php b/src/media.php
index 9f7a226..35b542c 100644
--- a/src/media.php
+++ b/src/media.php
@@ -14,20 +14,8 @@ class MediaManager {
add_action('init', [ $this, 'register_structure' ]);
- add_filter('attachment_fields_to_edit', [ $this, 'create_edit_media_control' ], 10, 2);
add_action('add_meta_boxes', [ $this, 'create_tag_management_box' ]);
- add_action('edit_attachment', [ $this, 'save_tags' ]);
-
- // Dont know what it does
- add_filter( 'update_post_term_count_statuses', function( $statuses, $taxonomy ) {
-
- if( 'folders' === $taxonomy->name ) {
- $statuses[] = 'inherit';
- $statuses = array_unique( $statuses );
- }
- return $statuses;
-
- }, 25, 2 );
+ add_action('edit_attachment', [ $this, 'save_tags' ]);
add_action('restrict_manage_posts', [ $this, 'show_list_filter' ]);
add_filter('pre_get_posts', [ $this, 'apply_list_filter' ]);
@@ -121,27 +109,6 @@ class MediaManager {
}
}
- public function create_edit_media_control( $fields, $post ) {
-
- /*$terms = get_terms([ 'taxonomy' => 'ttgf_media_tags', 'hide_empty' => false ]);
-
- $fields['ttgf_media_tags'] = [
- 'label' => 'Tags',
- 'input' => 'html',
- 'html' => $this->_build_dropdown("attachments[{$post->ID}][ttgf_media_tags]",
- array_map(function ($term) { return [ 'value' => $term->id, 'name' => $term->name ]; }, $terms),
- $post->ID)
- ];
-
- $fields['ttgf_media_hidden'] = [
- 'label' => 'Folder Attributes',
- 'input' => 'html',
- 'html' => ""
- ];*/
-
- return $fields;
- }
-
public function show_list_filter() {
global $typenow;
@@ -159,14 +126,17 @@ class MediaManager {
'orderby' => 'name',
'hierarchical' => true,
'value_field' => 'term_id',
+ 'selected' => 0,
'depth' => 3,
'hide_empty' => false,
'echo' => false
]);
- $selected = isset( $_GET[ $filter_name ] ) ? $_GET[ $filter_name ] : [];
+ $selected = array_key_exists($filter_name, $_GET) && ! empty($filter_name) ? $_GET[ $filter_name ] : [ "0" ];
$filter_dropdown = str_replace('