• Resolved neXorianus

    (@nexorianus)


    Hello,

    I ran into issues today after updating to WP 3.7.

    I have a wp_list_categories() call in my template with following parameters:

    $args = array(
        'orderby' => 'name',
        'order' => 'ASC',
        'exclude' => get_excluded_cats(), // e.g. 4,11
        'hide_empty' => 1,
        'title_li' => '',
        'walker' => new Category_Color_Walker()
    );

    get_excluded_cats() returns a comma separated list of categorie ids.

    The custom Walker is also not really special:

    class Category_Color_Walker extends Walker_Category
    {
    
        function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0)
        {
            extract($args);
            $cat_name = esc_attr($category->name);
            $cat_name = apply_filters('list_cats', $cat_name, $category);
            $link = '<a href="' . esc_url(get_term_link($category)) . '"';
    
            if(function_exists('get_tax_meta')){
                $css = '';
                if(get_tax_meta($category->term_id, 'ba_background_color_field_id') && get_tax_meta($category->term_id, 'ba_background_color_field_id') != '#')
                    $css .= 'background-color:' . get_tax_meta($category->term_id, 'ba_background_color_field_id') . ';';
    
                if( !empty($css) )
                    $link .= ' style="' . $css . '"';
            }
            $link .= '><span>' . $cat_name . '</span></a>';
    
            if ('list' == $args['style']) {
                $output .= "\t<li";
                $output .= ">$link\n";
            } else {
                $output .= "\t$link<br />\n";
            }
        }
    }

    Sadly the the categories with the corresponding ID’s still show up.
    Is there anything I’m doing wrong, or anything that I need to change?

    Thanks in advance,
    ~neX

Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘wp_list_categories does not accept 'exclude' anymore.’ is closed to new replies.