Support » Plugin: Beautiful taxonomy filters » Menu closes on click release and no post to display for one taxonomy

Viewing 15 replies - 1 through 15 (of 18 total)
  • 1) was solved by changing custom taxonomy slug.
    2) is not solved. I had to disable select2 library.

    I noticed something else:
    “Hide empty terms in the dropdowns: doesn’t work well, many terms appear with “(0)” i’d like to hide those.

    So to sum up my major problem right now terms with (0) still show up when i selected not to display them. if anyone can help me solve that it would be great.

    Plugin Author Jonathandejong


    Hi Doug,

    So has your issue with select2 solved itself or?
    If not, do you experience the same in all browsers?
    also, could you check the source of the page to make sure there’s not another plugin loading in select2 before BTF..

    Hide empty terms works through WordPress own “hide_empty” setting so it should work. Unless you have a filter or plugin that modifies this behaviour?

    Hi the select2 issue did not solve itself. I have 4 filters and they are all working normally except “Regions”, you can see it here:
    (it only happes on chrome, firefox and IE are fine).

    2nd issue is that terms with 0 still show up. But not all. I mean some have 0 and show up some don’t. I think this problem happens because i used this modified plugin
    To change old tags to custom taxonomies. It did a good job but it seems it forgot to set certain flag on the database or something because now with the filters up it’s not recognizing the terms with 0 properly. If you can think of any way to fix it let me know! I’m up for paid support if you provide it.

    Plugin Author Jonathandejong


    Hi Doug,

    You’ve unchecked the select2 option at the moment so I can’t have a look 🙂

    Regarding the empty terms.. yeah I can see how that might be the cause.
    I suppose you could create a function yourself where you get all terms (thats not “empty”). Then loop through each term and do a wp_query to find out wether they’re actually truly empty and if they are manually update this flag value in the DB.

    I’d love to help you more hands on with the code for this but as it is right now I’m swamped by my regular work projects. I could help you but it’d have to wait probably a few weeks before I can find the time.

    You could try posting the issue of terms not recognized as empty (after you did the conversion) to stackexchange and see if there’s people there to help you. Some people there are amazing and helpful and might even whip up a solution for you like the one I describe above.

    Hello! i have enabled select2 and i will leave it on until you reply here so you can see it. Basically click “Regions” on Chrome to reproduce.

    About the empty terms not recognized we made a post here:

    We used your exact words because we don’t know how to explain it better, sorry!

    I found a way to reproduce the terms with 0 showing up, it doesn’t happen because i used cat2tag plugin, that’s just how Beautiful taxonomy filters works, isn’t it?

    I did this:
    1) Create a new term under any custom taxonomy.
    – Check filters, it doesn’t show up. (hidden because of settings)

    2) Now Apply the new term to a custom post type A.
    -Check filters on CPT-A, it shows up as (1). perfect works.

    3) Now check a differentr CPT archive.
    – Term appears on dropdown with (0)!!!! <—Is this error or intended?

    Yes the term was used once but not on this CPT so it shouldn’t show up, but it shows up with (0). That’s just how the plugin works or is it just me?

    Plugin Author Jonathandejong


    Hi Doug,

    Regions are working fine for me too when I test it. Using chrome Version 49.0.2623.110 (64-bit). See screenshot.

    Regarding the empty term I think you might’ve stumbled upon a bug.
    Thing is that WordPress own post-count for each term does not take into account which CPT archive you’re on if a taxonomy is connected to more than one. So BTF has it’s own count which only counts for the current CPT archive.

    However this poses a problem with the “Hide empty terms”. Because that’s a setting in WordPress Core (get_terms) it too does not account for different CPT archives using the same taxonomies. I’ll have to have a look if I can manually exclude those terms myself with the next version. Thank you for finding and reporting this 🙂

    Awesome! that must be the cause then! I’m looking forward the next version.

    As for the the “regions” dropdown i noticed it is different than all the others. For example there’s a search function (you can type and search) for all the others but not that one. Why is that?

    Plugin Author Jonathandejong


    that is due to the search threshold. If a dropdown has more than 8 results the searchform in select2 will kick in as an added usability-feature.

    You can turn this of yourself using one of BTF filters.
    This would make the search always there:

    function change_minsearch_value($min_search){
        //always show search
        return 1;
    add_filter('beautiful_filters_selec2_minsearch', 'change_minsearch_value');

    and this would remove it completely:

    function change_minsearch_value($min_search){
        //always show search
        return 'Infinity';
    add_filter('beautiful_filters_selec2_minsearch', 'change_minsearch_value');

    Wow haha this is just great, i found out why i was getting this issue and why you weren’t, see, i wasn’t exactly clicking the dropdown arrow i was just clicking the text “All regions” if you do that the menu closes itself when you release the click (on chrome), it didn’t happen with the other boxes because they have the searchbox. So for now i’ll just add the searchbox to all fields because i don’t think people will get that you must only click the little arrow, i know didn’t. Well, maybe i’m just dumb…

    I’ve modified the code to exclude terms with 0. I’m not a coder so i don’t know if this is bad for performance or simply wrong, i only know it works.
    Please have a look:

    I modified the output file: /wp-content/plugins/beautiful-taxonomy-filters/public/class-beautiful-taxonomy-filters-walker.php

    Basically what i did was move the $count variable that holds the term count before the output starts and after that i added an if “$count > 0” statement.

    Here’s the whole function, please let me know if this could cause problems.

    `function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) {

    global $wp_query;
    $queryvars = $wp_query->query_vars;
    $cat_name = apply_filters(‘list_cats’, $category->name, $category);
    $count = Beautiful_Taxonomy_Filters_Public::get_term_post_count_by_type($category->slug, $category->taxonomy, $this->post_type);
    if ($count > 0) {
    $output .= “\t” . ‘<option class=”level-‘ . $depth . ‘ ‘ . $category->slug . ‘” value=”‘ . $category->slug . ‘”‘;
    foreach($_GET as $get_variable){
    if(strpos($get_variable,’,’) !== false){
    $get_array = explode(‘,’, $get_variable);
    $get_array[] = $get_variable;
    foreach($get_array as $get_single){
    if ( $category->term_id == $args[‘selected’] || $get_single == $category->slug ){
    $output .= ‘ selected=”selected” ‘;
    if ( in_array($category->slug, $queryvars, true) ) {
    $output .= ‘ selected=”selected” ‘;
    $output .= ‘>’;

    //run our custom filter
    $output .= apply_filters( ‘beautiful_filters_term_name’, $cat_name, $category, $depth );

    if ( $args[‘show_count’] ){
    //If they want a post count make sure to only show the count for this specific post type
    $output .= ‘  (‘ . $count . ‘)’;

    if (isset ( $args[‘show_last_update’] ) ) {
    $format = ‘Y-m-d’;
    $output .= ‘  ‘ . gmdate($format, $category->last_update_timestamp);

    if( $this->show_description && $category->description ){
    //If we dont want select2 we cant put anything fancy around the description so this will have to do.
    if( $this->disable_select2 ){
    $output .= ‘ – ‘ . $category->description;
    } else {
    //We just use an unlikely textstring so we can target it with JS later.
    $output .= ‘:.:’ . $category->description . ‘:-:’;


    $output .= “</option>\n”;


    Plugin Author Jonathandejong


    Thanks Doug,

    Can you please post the code in a service like
    It’s impossible to view it like it is now 🙂

    In regards to the issue from before. Glad you worked it out! I still think it’s somewhat of a bug that you have to click the arrow.. maybe you’re an edge-case and it’ll be fixed in a future release of select2 🙂

    The changes are:
    1) the definition of “$count” was moved to line 18 (before the output begins).
    2) An if statement was added to line 19.

    That’s all.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Menu closes on click release and no post to display for one taxonomy’ is closed to new replies.