Custom Taxonomy Order NE - Version 3.4.2

Version Description

  • 2022-04-27
  • Do not use the previous change on admin dashboard, some WooCommerce pages are way too heavy with terms.
Download this release

Release Info

Developer mpol
Plugin Icon 128x128 Custom Taxonomy Order NE
Version 3.4.2
Comparing to
See all releases

Code changes from version 3.4.1 to 3.4.2

Files changed (2) hide show
  1. customtaxorder.php +42 -36
  2. readme.txt +5 -1
customtaxorder.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Taxonomy Order
4
  Plugin URI: https://wordpress.org/plugins/custom-taxonomy-order-ne/
5
  Description: Allows for the ordering of categories and custom taxonomy terms through a simple drag-and-drop interface.
6
- Version: 3.4.1
7
  Author: Marcel Pol
8
  Author URI: https://timelord.nl/
9
  License: GPLv2 or later
@@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
39
 
40
 
41
  // Plugin Version
42
- define('CUSTOMTAXORDER_VER', '3.4.1');
43
 
44
 
45
  /*
@@ -235,23 +235,26 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
235
  if ( is_object($ancestor_term) && isset($ancestor_term->term_order) ) {
236
 
237
  // calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
238
- $args = array(
239
- 'orderby' => 'term_order',
240
- 'order' => 'ASC',
241
- 'hide_empty' => false,
242
- 'parent' => $ancestor_id,
243
- );
244
- $sister_terms = get_term_children( $ancestor_id, $taxonomy );
245
- if ( is_array( $sister_terms ) ) { // should always be an array, since this term does exist.
246
- $count = count( $sister_terms );
247
- if ( $count < 10 ) {
248
- $padding = 0;
249
- } else if ( $count < 100 ) {
250
- $padding = 10;
251
- } else if ( $count < 1000 ) {
252
- $padding = 100;
253
- } else if ( $count < 10000 ) {
254
- $padding = 1000;
 
 
 
255
  }
256
  }
257
  $rear_of_float .= (string) ($ancestor_term->term_order + $padding);
@@ -259,23 +262,26 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
259
  }
260
 
261
  // calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
262
- $args = array(
263
- 'orderby' => 'term_order',
264
- 'order' => 'ASC',
265
- 'hide_empty' => false,
266
- 'parent' => $term->parent,
267
- );
268
- $sister_terms = get_term_children( $term->parent, $taxonomy );
269
- if ( is_array( $sister_terms ) ) { // should always be an array, since this term does exist.
270
- $count = count( $sister_terms );
271
- if ( $count < 10 ) {
272
- $padding = 0;
273
- } else if ( $count < 100 ) {
274
- $padding = 10;
275
- } else if ( $count < 1000 ) {
276
- $padding = 100;
277
- } else if ( $count < 10000 ) {
278
- $padding = 1000;
 
 
 
279
  }
280
  }
281
  $rear_of_float .= (string) ($term->term_order + $padding);
3
  Plugin Name: Custom Taxonomy Order
4
  Plugin URI: https://wordpress.org/plugins/custom-taxonomy-order-ne/
5
  Description: Allows for the ordering of categories and custom taxonomy terms through a simple drag-and-drop interface.
6
+ Version: 3.4.2
7
  Author: Marcel Pol
8
  Author URI: https://timelord.nl/
9
  License: GPLv2 or later
39
 
40
 
41
  // Plugin Version
42
+ define('CUSTOMTAXORDER_VER', '3.4.2');
43
 
44
 
45
  /*
235
  if ( is_object($ancestor_term) && isset($ancestor_term->term_order) ) {
236
 
237
  // calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
238
+ // Do not do this on admin dashboard, some WooCommerce pages are way too heavy with terms.
239
+ if ( ! is_admin() ) {
240
+ $args = array(
241
+ 'orderby' => 'term_order',
242
+ 'order' => 'ASC',
243
+ 'hide_empty' => false,
244
+ 'parent' => $ancestor_id,
245
+ );
246
+ $sister_terms = get_term_children( $ancestor_id, $taxonomy );
247
+ if ( is_array( $sister_terms ) ) { // should always be an array, since this term does exist.
248
+ $count = count( $sister_terms );
249
+ if ( $count < 10 ) {
250
+ $padding = 0;
251
+ } else if ( $count < 100 ) {
252
+ $padding = 10;
253
+ } else if ( $count < 1000 ) {
254
+ $padding = 100;
255
+ } else if ( $count < 10000 ) {
256
+ $padding = 1000;
257
+ }
258
  }
259
  }
260
  $rear_of_float .= (string) ($ancestor_term->term_order + $padding);
262
  }
263
 
264
  // calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
265
+ // Do not do this on admin dashboard, some WooCommerce pages are way too heavy with terms.
266
+ if ( ! is_admin() ) {
267
+ $args = array(
268
+ 'orderby' => 'term_order',
269
+ 'order' => 'ASC',
270
+ 'hide_empty' => false,
271
+ 'parent' => $term->parent,
272
+ );
273
+ $sister_terms = get_term_children( $term->parent, $taxonomy );
274
+ if ( is_array( $sister_terms ) ) { // should always be an array, since this term does exist.
275
+ $count = count( $sister_terms );
276
+ if ( $count < 10 ) {
277
+ $padding = 0;
278
+ } else if ( $count < 100 ) {
279
+ $padding = 10;
280
+ } else if ( $count < 1000 ) {
281
+ $padding = 100;
282
+ } else if ( $count < 10000 ) {
283
+ $padding = 1000;
284
+ }
285
  }
286
  }
287
  $rear_of_float .= (string) ($term->term_order + $padding);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mpol
3
  Tags: term order, category order, taxonomy order, order
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
- Stable tag: 3.4.1
7
  License: GPLv2 or later
8
 
9
 
@@ -213,6 +213,10 @@ The left metabox lists the toplevel terms. Right (or below) are the sub-terms.
213
 
214
  == Changelog ==
215
 
 
 
 
 
216
  = 3.4.1 =
217
  * 2022-04-27
218
  * Improve ordering nested sub-terms.
3
  Tags: term order, category order, taxonomy order, order
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
+ Stable tag: 3.4.2
7
  License: GPLv2 or later
8
 
9
 
213
 
214
  == Changelog ==
215
 
216
+ = 3.4.2 =
217
+ * 2022-04-27
218
+ * Do not use the previous change on admin dashboard, some WooCommerce pages are way too heavy with terms.
219
+
220
  = 3.4.1 =
221
  * 2022-04-27
222
  * Improve ordering nested sub-terms.