WordPress.org

Support

Support » Plugins and Hacks » Not showing taxonomies associated to more than 1 custom post type

Not showing taxonomies associated to more than 1 custom post type

  • fcingolani
    Member

    @fcingolani

    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/

  • The topic ‘Not showing taxonomies associated to more than 1 custom post type’ is closed to new replies.