WordPress.org

Ready to get started?Download WordPress

Forums

TC Custom Taxonomy Filter
Not showing taxonomies associated to more than 1 custom post type (1 post)

  1. fcingolani
    Member
    Posted 11 months ago #

    When a taxonomy is associated to more than one post type, it doesn't show up in the filters list. This happens because of how wp_filter_object_list works (used by get_taxonomies). I've come up with a workaround that suits my needs, use it freely if you want to.

    I've replaced the original tc_ctf_get_filters function with these two:

    function tc_ctf_exclude_builtin($tax){
        return $tax->_builtin == false;
    }
    
    // Get only the custom taxonomies associated with this post type
    function tc_ctf_get_filters() {
        global $typenow;
    
        $taxonomies = get_object_taxonomies($typenow, 'objects' );
        return array_keys(array_filter($taxonomies, 'tc_ctf_exclude_builtin'));
    }

    Thanks for this plugin!

    http://wordpress.org/extend/plugins/tc-custom-taxonomy-filter/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 11 months ago by fcingolani
  • This topic is not a support question
  • WordPress version: 3.5.1

Tags

No tags yet.