Custom Taxonomy Order NE - Version 3.4.3

Version Description

  • 2022-04-30
  • Ouch, don't do those calculations on frontend either when there are too many terms, it is too expensive.
Download this release

Release Info

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

Code changes from version 3.4.2 to 3.4.3

Files changed (2) hide show
  1. customtaxorder.php +9 -6
  2. readme.txt +6 -2
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.2
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.2');
43
 
44
 
45
  /*
@@ -178,6 +178,7 @@ add_filter('get_terms_defaults', 'customtaxorder_get_terms_defaults', 10, 2);
178
  *
179
  */
180
  function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
 
181
  $options = customtaxorder_get_settings();
182
 
183
  /*if ( is_admin() ) {
@@ -202,6 +203,8 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
202
  break; // just the first one :)
203
  }
204
 
 
 
205
  if ( ! isset ( $options[$taxonomy] ) ) {
206
  $options[$taxonomy] = 0; // default if not set in options yet
207
  }
@@ -235,8 +238,8 @@ 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
- // 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',
@@ -262,8 +265,8 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
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',
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.3
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.3');
43
 
44
 
45
  /*
178
  *
179
  */
180
  function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
181
+
182
  $options = customtaxorder_get_settings();
183
 
184
  /*if ( is_admin() ) {
203
  break; // just the first one :)
204
  }
205
 
206
+ $terms_count = count( $terms );
207
+
208
  if ( ! isset ( $options[$taxonomy] ) ) {
209
  $options[$taxonomy] = 0; // default if not set in options yet
210
  }
238
  if ( is_object($ancestor_term) && isset($ancestor_term->term_order) ) {
239
 
240
  // calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
241
+ // Do not do this with too many terms, some WooCommerce pages are way too heavy with terms.
242
+ if ( $terms_count < 700 ) {
243
  $args = array(
244
  'orderby' => 'term_order',
245
  'order' => 'ASC',
265
  }
266
 
267
  // calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
268
+ // Do not do this with too many terms, some WooCommerce pages are way too heavy with terms.
269
+ if ( $terms_count < 700 ) {
270
  $args = array(
271
  'orderby' => 'term_order',
272
  'order' => 'ASC',
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.2
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.2 =
217
  * 2022-04-27
218
  * Do not use the previous change on admin dashboard, some WooCommerce pages are way too heavy with terms.
2
  Contributors: mpol
3
  Tags: term order, category order, taxonomy order, order
4
  Requires at least: 3.7
5
+ Tested up to: 6.0
6
+ Stable tag: 3.4.3
7
  License: GPLv2 or later
8
 
9
 
213
 
214
  == Changelog ==
215
 
216
+ = 3.4.3 =
217
+ * 2022-04-30
218
+ * Ouch, don't do those calculations on frontend either when there are too many terms, it is too expensive.
219
+
220
  = 3.4.2 =
221
  * 2022-04-27
222
  * Do not use the previous change on admin dashboard, some WooCommerce pages are way too heavy with terms.