Media Library Categories - Version 1.9.8

Version Description

  • Remember selected category in dropdown when filtered
Download this release

Release Info

Developer jeffrey-wp
Plugin Icon 128x128 Media Library Categories
Version 1.9.8
Comparing to
See all releases

Code changes from version 1.9.7 to 1.9.8

Files changed (2) hide show
  1. index.php +7 -3
  2. readme.txt +5 -2
index.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Media Library Categories
4
  * Plugin URI: https://wordpress.org/plugins/wp-media-library-categories/
5
  * Description: Adds the ability to use categories in the media library.
6
- * Version: 1.9.7
7
  * Author: Jeffrey-WP
8
  * Text Domain: wp-media-library-categories
9
  * Domain Path: /languages
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  */
22
  class wpMediaLibraryCategories {
23
 
24
- public $plugin_version = '1.9.7';
25
 
26
  /**
27
  * Initialize the hooks and filters
@@ -306,11 +306,12 @@ class wpMediaLibraryCategories {
306
  * @action restrict_manage_posts
307
  */
308
  public function wpmediacategory_add_category_filter() {
309
- global $pagenow;
310
  if ( 'upload.php' == $pagenow ) {
311
  // Get taxonomy slug
312
  $taxonomy = $this->get_wpmlc_taxonomy();
313
  if ( $taxonomy != 'category' ) {
 
314
  $dropdown_options = array(
315
  'taxonomy' => $taxonomy,
316
  'name' => $taxonomy,
@@ -319,11 +320,13 @@ class wpMediaLibraryCategories {
319
  'hide_empty' => false,
320
  'hierarchical' => true,
321
  'orderby' => 'name',
 
322
  'show_count' => true,
323
  'walker' => new wpmediacategory_walker_category_filter(),
324
  'value' => 'slug'
325
  );
326
  } else {
 
327
  $dropdown_options = array(
328
  'taxonomy' => $taxonomy,
329
  'class' => 'postform wpmlc-taxonomy-filter',
@@ -331,6 +334,7 @@ class wpMediaLibraryCategories {
331
  'hide_empty' => false,
332
  'hierarchical' => true,
333
  'orderby' => 'name',
 
334
  'show_count' => false,
335
  'walker' => new wpmediacategory_walker_category_filter(),
336
  'value' => 'id'
3
  * Plugin Name: Media Library Categories
4
  * Plugin URI: https://wordpress.org/plugins/wp-media-library-categories/
5
  * Description: Adds the ability to use categories in the media library.
6
+ * Version: 1.9.8
7
  * Author: Jeffrey-WP
8
  * Text Domain: wp-media-library-categories
9
  * Domain Path: /languages
21
  */
22
  class wpMediaLibraryCategories {
23
 
24
+ public $plugin_version = '1.9.8';
25
 
26
  /**
27
  * Initialize the hooks and filters
306
  * @action restrict_manage_posts
307
  */
308
  public function wpmediacategory_add_category_filter() {
309
+ global $pagenow, $wp_query;
310
  if ( 'upload.php' == $pagenow ) {
311
  // Get taxonomy slug
312
  $taxonomy = $this->get_wpmlc_taxonomy();
313
  if ( $taxonomy != 'category' ) {
314
+ $selected = isset( $wp_query->query[$taxonomy] ) ? $wp_query->query[$taxonomy] : 0;
315
  $dropdown_options = array(
316
  'taxonomy' => $taxonomy,
317
  'name' => $taxonomy,
320
  'hide_empty' => false,
321
  'hierarchical' => true,
322
  'orderby' => 'name',
323
+ 'selected' => $selected,
324
  'show_count' => true,
325
  'walker' => new wpmediacategory_walker_category_filter(),
326
  'value' => 'slug'
327
  );
328
  } else {
329
+ $selected = isset( $wp_query->query['cat'] ) ? $wp_query->query['cat'] : 0;
330
  $dropdown_options = array(
331
  'taxonomy' => $taxonomy,
332
  'class' => 'postform wpmlc-taxonomy-filter',
334
  'hide_empty' => false,
335
  'hierarchical' => true,
336
  'orderby' => 'name',
337
+ 'selected' => $selected,
338
  'show_count' => false,
339
  'walker' => new wpmediacategory_walker_category_filter(),
340
  'value' => 'id'
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: category, categories, media, library, medialibrary, image, images, media category, media categories
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
- Stable tag: 1.9.7
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -23,7 +23,7 @@ There is even an option to filter on categories when using the gallery shortcode
23
  * filter on categories in the media library
24
  * filter on categories in the gallery shortcode
25
  * taxonomy filter
26
- * support for WordPress 3.1 – 5.3
27
 
28
  > <strong>Try Premium version - 100% money back guarantee</strong>
29
  > WordPress Media Library Categories Premium adds the option to filter on categories when inserting media into a post or page.
@@ -97,6 +97,9 @@ Maintaining a plugin and keeping it up to date is hard work. Please support me b
97
 
98
  == Changelog ==
99
 
 
 
 
100
  = 1.9.7 =
101
  * Add autocomplete search to the category dropdown in Media Library list view (which can be turned on under Settings → Media)
102
  * Add usability fix to highlight media library settings section when directly linked
4
  Tags: category, categories, media, library, medialibrary, image, images, media category, media categories
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
+ Stable tag: 1.9.8
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
23
  * filter on categories in the media library
24
  * filter on categories in the gallery shortcode
25
  * taxonomy filter
26
+ * support for WordPress 3.1 – 5.4
27
 
28
  > <strong>Try Premium version - 100% money back guarantee</strong>
29
  > WordPress Media Library Categories Premium adds the option to filter on categories when inserting media into a post or page.
97
 
98
  == Changelog ==
99
 
100
+ = 1.9.8 =
101
+ * Remember selected category in dropdown when filtered
102
+
103
  = 1.9.7 =
104
  * Add autocomplete search to the category dropdown in Media Library list view (which can be turned on under Settings → Media)
105
  * Add usability fix to highlight media library settings section when directly linked