• Resolved arypneta

    (@arypneta)


    We are pretty regularly getting messages in our error log like:

    KILLED QUERY (36063 characters long generated in wp-content/plugins/seriously-simple-podcasting/php/includes/ssp-functions.php:1773: SELECT t.*, tt.* FROM wp_2_terms AS t INNER JOIN wp_2_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (…)

    Any ideas on how to optimize the query or stop this from happening? We have a good chunk of tags on this site (over 6,000), so maybe the answer is just to use tags less frequently and delete less frequently used ones, but figured I’d reach out to see if you had any ideas.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    Hi @arypneta,

    Thanks for bringing this to our attention!

    We’ve investigated and identified the issue. The query is triggered when loading the block editor — our plugin preloads all available tags there, and with 6,000+ tags that results in an oversized query.

    We’ll be optimizing this in a future update so tags are loaded on demand rather than all at once.

    In the meantime, you can work around it by creating a file called ssp-limit-tags.php in your wp-content/mu-plugins/ directory (create the mu-plugins folder if it doesn’t exist):

    <?php
    function ssp_get_tags( $hide_empty = false ) {
    $cache_key = 'ssp_tags';
    $cache_group = 'ssp';
    $tags = wp_cache_get( $cache_key, $cache_group );

    if ( $tags ) {
    return $tags;
    }

    $tags = get_terms(
    'post_tag',
    array(
    'post_type' => ssp_post_types(),
    'hide_empty' => $hide_empty,
    'number' => 100,
    'orderby' => 'count',
    'order' => 'DESC',
    )
    );

    wp_cache_set( $cache_key, $tags, $cache_group, MINUTE_IN_SECONDS );

    return is_array( $tags ) ? $tags : array();
    }

    Please let us know if you have any questions and if it works for you.

    Thread Starter arypneta

    (@arypneta)

    Okay, perfect – thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.