1

I'm placing a list of category links with this code:

<div><h2>Categories List</h2>
    <ul>
    <?php          
        function my_cat_title($category_description,$category){
            return '';
        }

        $cat_args = array('orderby' => 'name');
        $cat_args['title_li'] = '';
        $cat_args['exclude_tree'] = 1;
        $cat_args['use_desc_for_title'] = 1;
        add_filter('category_description','my_cat_title');
        wp_list_categories(apply_filters('widget_categories_args', $cat_args));
        remove_filter('category_description','my_cat_title');

        ?>
    </ul>
</div>

However, each of the links has a title attribute like 'title="View all posts filed under x"'

How can I remove the title attribute altogether?

1

If you use the category_description filter hook you can replace the title attribute for example:

function my_cat_title($category_description,$category){
   return '';
}
add_filter('category_description','my_cat_title');
$cat_args = array('orderby' => 'name');
$cat_args['title_li'] = '';
$cat_args['exclude_tree'] = my_cat();
wp_list_categories(apply_filters('widget_categories_args', $cat_args));
remove_filter('category_description','my_cat_title');
  • Hmm, its not working for me :-( I've updated my question with the revised code. I'm still getting a title attribute on the links – N2Mystic Sep 7 '11 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.