I just saw the same thing for the plugin which is pretty cool Weighted Categories.
It is using the depreciated version of this.
I am about to put in a patch fix. There is a bug as far
as I am concerned.
Modify wp-includes/category-template.php
Change wp_list_catories to end with:
$output = apply_filters(‘list_cats’, $output);
if ( $echo ) echo $output;
return $output;
INSTEAD of
echo apply_filters(‘list_cats’, $output);
If you want that to actually work, you should do this:
$output = apply_filters('list_cats', $output);
if ( $r['echo'] ) echo $output;
else return $output;
Also you should add this to the $defaults array:
'echo' => 1
In order to make the behavior consistent. After making these you changes, you’ll be able to do this sort of thing:
$stuff = wp_list_categories('echo=0&other_options=whatever...');
…and get the results back in $stuff.
I’ve modified your bug report to explain this more clearly and to try to get action taken on it. It’s a simple and obvious change that should have been there already, hopefully it’ll get pushed into 2.2.
Yes, I’d also like to be able to do this… but without having to modify the WP core files. I’m running WP 2.2 but the behaviour is still the same. Can anyone running a more recent version confirm whether the behaviour has been fixed?
I just ran into this problem with 2.2.2. It’s not a big deal but the documentation (http://codex.wordpress.org/Template_Tags/wp_list_categories) does say echo should be a parameter.
‘echo’ appeared in wp_list_categories() with 2.3.
‘echo’ appeared in wp_list_categories() with 2.3.
Could you give an example of how to use it and maybe add it to the codex? I’m having trouble using it…
http://wordpress.org/support/topic/146145?replies=5
davidemorgan, I’ve answered your question in the other thread. Basically, you need to use a different WP function for what you’re trying to do.
Thank you. Now I’m not feeling too stupid.