• Hi,

    i’ve got a website using Taxonomy Images. We have a lot of categories (300+) with Taxonomy Images. The website became extremely slow. With Query Monitor I found that Taxonomy Images is the cause.

    What I think what is happening: When opening a category with subcategories, not the subcategories are loaded which are used at that time, but every single term with a taxonomy image, without those being displayed.

    This is my code:

    <?php
    $cat = 3;
    $term_meta = get_option( "taxonomy_{$cat}" );?>
    <?php
    $cat_id = get_query_var('cat');
    $catlist = get_categories('parent=' . $cat . '&hide_empty=1&number=20');
    echo '<ul class="categorieoverview">';
    
    foreach($catlist as $categories_item)
    {
    
        $terms = apply_filters( 'taxonomy-images-get-terms', '' );
        if ( ! empty( $terms ) ) {
    
          foreach( (array) $terms as $term ) {
            if($term->term_id == $categories_item->term_id) {
    	$img = $wp_get_attachment_image;
          if (!empty($img)) {
    $show = block;
    }
    else { $show = none; }

    Does anyone have an idea what goes wrong and what makes the site this slow?

    Thanks in advance.

  • The topic ‘Very Slow Query’ is closed to new replies.