Exclude categories functionality not working in gallery filter on WordPress 3.7

Update: The issue has been fixed in the new WordPress 3.7.1, all you have to do is to update your WordPress installation to the latest version available.

The new WordPress 3.7 has introduced a new minor issue in the gallery filter Рwhen some portfolio categories are excluded from the gallery page, they are still displayed in the gallery filter. After debugging the problem we found that the exclude_tree option in the WordPress get_terms function is not working properly, which is an issue of WordPress 3.7. Fortunately the issue has been already fixed in the WordPress trunk and the fix should be available in the next WordPress update.

Meanwhile, as a temporary solution the exclude option can be used instead of exclude_tree that works with single categories only (not a hierarchy tree of categories) – you can very easily fix it by editing the template-portfolio-gallery.php file and modify the following line (line 57 in Mineral and line 53 in Evermore):

$cats=get_terms(PEXETO_PORTFOLIO_TAXONOMY, array("hide_empty"=>false, "hierarchical"=>true, "exclude_tree"=>$exclude_cats));

to be like this:

$cats=get_terms(PEXETO_PORTFOLIO_TAXONOMY, array("hide_empty"=>false, "hierarchical"=>true, "exclude"=>$exclude_cats));

Was this useful? 1