Support » Plugin: Collapsing Categories » Breaks taxonomies / tag cloud because of filters not unregistered

  • Hi, and thanks for the plugin!

    I’d like to report an issue (and the corresponding fix).

    In collapscatlist.php, in lines 501 to 503, three filters are registered:

      add_filter('description', 'collapscat_replace_newlines');
      add_filter('get_terms', 'collapscat_catfilter');
      add_filter('get_terms_orderby', 'collapscat_orderbyfilter');

    These three filters are registered to alter the result of a subsequent call to get_terms, about three lines below.

    $categories = get_terms($taxonomy, $args);

    The problem is that those filters are never unregistered, which means that they are still applied to subsequent calls to get_terms. In particular, if you hava a tag cloud and it comes after this plugin in rendering order, it will destroy the ordering (the tags that will come up will be the latest in alphabetical order, no matter what their actual counts are).

    The fix is easy; after the above call to get_terms, unregister the filters by adding the following lines:

      remove_filter('get_terms', 'collapscat_catfilter');
      remove_filter('get_terms_orderby', 'collapscat_orderbyfilter');
      remove_filter('description', 'collapscat_replace_newlines');

    Please consider including the above fix in a new version of the plugin.


  • The topic ‘Breaks taxonomies / tag cloud because of filters not unregistered’ is closed to new replies.