Category Order and Taxonomy Terms Order - Version 1.5.6

Version Description

  • Rely on 'terms_clauses' filter than 'get_terms_orderby' as producing issues with the $maybe_orderby_meta backward compatibility.
    • Fix WooCommerce category order apply
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 Category Order and Taxonomy Terms Order
Version 1.5.6
Comparing to
See all releases

Code changes from version 1.5.5 to 1.5.6

Files changed (2) hide show
  1. readme.txt +6 -2
  2. taxonomy-terms-order.php +13 -12
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nsp-code
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: category order,terms order, taxonomy order, admin order, categories sort, order category
5
  Requires at least: 2.8
6
- Tested up to: 4.9.8
7
- Stable tag: 1.5.5
8
 
9
  Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
10
 
@@ -59,6 +59,10 @@ Consider upgrading to our advanced version of this plugin at a very resonable pr
59
 
60
  == Change Log ==
61
 
 
 
 
 
62
  = 1.5.5 =
63
  - Ignore admin sort when using columns order within Taxonomy interface
64
 
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: category order,terms order, taxonomy order, admin order, categories sort, order category
5
  Requires at least: 2.8
6
+ Tested up to: 5.2
7
+ Stable tag: 1.5.6
8
 
9
  Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
10
 
59
 
60
  == Change Log ==
61
 
62
+ = 1.5.6 =
63
+ - Rely on 'terms_clauses' filter than 'get_terms_orderby' as producing issues with the $maybe_orderby_meta backward compatibility.
64
+ - Fix WooCommerce category order apply
65
+
66
  = 1.5.5 =
67
  - Ignore admin sort when using columns order within Taxonomy interface
68
 
taxonomy-terms-order.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Category Order and Taxonomy Terms Order
4
  Plugin URI: http://www.nsp-code.com
5
  Description: Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
6
- Version: 1.5.5
7
  Author: Nsp-Code
8
  Author URI: http://www.nsp-code.com
9
  Author Email: electronice_delphi@yahoo.com
@@ -121,10 +121,12 @@ Domain Path: /languages/
121
  }
122
  }
123
 
124
- function TO_apply_order_filter($orderby, $args)
 
 
125
  {
126
- if ( apply_filters('to/get_terms_orderby/ignore', FALSE, $orderby, $args) )
127
- return $orderby;
128
 
129
  $options = tto_get_settings();
130
 
@@ -134,25 +136,24 @@ Domain Path: /languages/
134
 
135
  //return if use orderby columns
136
  if (isset($_GET['orderby']) && $_GET['orderby'] != 'term_order')
137
- return $orderby;
138
 
139
  if ($options['adminsort'] == "1")
140
- return 't.term_order';
141
 
142
- return $orderby;
143
  }
144
 
145
  //if autosort, then force the menu_order
146
  if ($options['autosort'] == 1 && (!isset($args['ignore_term_order']) || (isset($args['ignore_term_order']) && $args['ignore_term_order'] !== TRUE) ))
147
  {
148
- return 't.term_order';
149
  }
150
 
151
- return $orderby;
152
  }
153
 
154
- add_filter('get_terms_orderby', 'TO_apply_order_filter', 10, 2);
155
-
156
  add_filter('get_terms_orderby', 'TO_get_terms_orderby', 1, 2);
157
  function TO_get_terms_orderby($orderby, $args)
158
  {
@@ -198,6 +199,6 @@ Domain Path: /languages/
198
 
199
  die();
200
  }
201
-
202
 
203
  ?>
3
  Plugin Name: Category Order and Taxonomy Terms Order
4
  Plugin URI: http://www.nsp-code.com
5
  Description: Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
6
+ Version: 1.5.6
7
  Author: Nsp-Code
8
  Author URI: http://www.nsp-code.com
9
  Author Email: electronice_delphi@yahoo.com
121
  }
122
  }
123
 
124
+
125
+ add_filter('terms_clauses', 'TO_apply_order_filter', 10, 3);
126
+ function TO_apply_order_filter( $clauses, $taxonomies, $args)
127
  {
128
+ if ( apply_filters('to/get_terms_orderby/ignore', FALSE, $clauses['orderby'], $args) )
129
+ return $clauses;
130
 
131
  $options = tto_get_settings();
132
 
136
 
137
  //return if use orderby columns
138
  if (isset($_GET['orderby']) && $_GET['orderby'] != 'term_order')
139
+ return $clauses;
140
 
141
  if ($options['adminsort'] == "1")
142
+ $clauses['orderby'] = 'ORDER BY t.term_order';
143
 
144
+ return $clauses;
145
  }
146
 
147
  //if autosort, then force the menu_order
148
  if ($options['autosort'] == 1 && (!isset($args['ignore_term_order']) || (isset($args['ignore_term_order']) && $args['ignore_term_order'] !== TRUE) ))
149
  {
150
+ $clauses['orderby'] = 'ORDER BY t.term_order';
151
  }
152
 
153
+ return $clauses;
154
  }
155
 
156
+
 
157
  add_filter('get_terms_orderby', 'TO_get_terms_orderby', 1, 2);
158
  function TO_get_terms_orderby($orderby, $args)
159
  {
199
 
200
  die();
201
  }
202
+
203
 
204
  ?>