• Resolved Brian Henry

    (@brianhenryie)


    
    [10-Dec-2020 01:58:28 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function wc_get_attribute_taxonomies() in /path/to/wp-content/plugins/taxonomy-terms-order/include/addons.php:32
    Stack trace:
    #0 /path/to/wp-includes/class-wp-hook.php(287): to_get_terms_orderby_ignore_woocommerce(false, 't.name', Array)
    #1 /path/to/wp-includes/plugin.php(212): WP_Hook->apply_filters(false, Array)
    #2 /path/to/wp-content/plugins/taxonomy-terms-order/taxonomy-terms-order.php(160): apply_filters('to/get_terms_or...', false, 't.name', Array)
    #3 /path/to/wp-includes/class-wp-hook.php(289): TO_get_terms_orderby('t.name', Array)
    #4 /path/to/wp-includes/plugin.php(212): WP_Hook->apply_filters('t.name', Array)
    #5 /path/to/wp-includes/class-wp-term-query.php(901): apply_filters('get_terms_order...', ' in /path/to/wp-content/plugins/taxonomy-terms-order/include/addons.php on line 32
    

    As you said in another thread, you check is WooCommerce active. That is not sufficient – you need to hook into woocommerce_loaded.

    Update your addons.php file with:

    
    // WooCommerce Attribute order.
    add_action(
    	'woocommerce_loaded',
    	function() {
    		add_action( 'to/get_terms_orderby/ignore', 'to_get_terms_orderby_ignore_woocommerce', 10, 3 );
    	}
    );
    function to_get_terms_orderby_ignore_woocommerce( $ignore, $orderby, $args ) {
    	
    	// Create a list of attribute taxonomies.
    	$attributes           = wc_get_attribute_taxonomies();
    	$found_attributex_tax = array();
    	foreach ( $attributes    as  $attribute ) {
    		$found_attributex_tax[] = 'pa_' . $attribute->attribute_name;
    	}
    
    	if ( ! isset( $args['taxonomy'] ) || count( $args['taxonomy'] ) !== 1 ) {
    		return $ignore;
    	}
    
    	if ( count( array_intersect( $found_attributex_tax, $args['taxonomy'] ) ) < 1 ) {
    		return $ignore;
    	}
    
    	return true;
    
    }
    
    • This topic was modified 3 years, 11 months ago by Brian Henry.
Viewing 1 replies (of 1 total)
  • Plugin Author Maya

    (@tdgu)

    Hi,
    Thanks for your feedback, this should be now fixed in latest 1.5.7.4

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘WP 5.6 Fatal error: Fixed.’ is closed to new replies.