1. Nice article, sometimes I get confused on how to remove part of my wordpress theme, thanks for the tutorial!

  2. Hi Ronnie,

    Your instructions seem clear — but it didn’t work at all for me! I’d rather delete the Comments widget and delete the line of code. But, I can’t find it in the theme code anywhere!

    Any ideas how I can just delete it?


    1. Laurie, we are using the same versions of WordPress and it works for me.

      You will not see the code inside of your theme files at all. That snippet of code gets injected into the Head section by WP when it creates your page.

      The only way to get rid of it, outside of the fix above, is to remove the Recent Comment widget via your control panel.

      The code does not hurt anything by being there, except that it makes it difficult to style the display, margin, and padding for the div.

  3. I got that working on my blog, thanks for a great tip.

  4. Thanks for your post, i really needed this tutorial

  5. Nice and simple tutorial to style the comments

  6. Very useful. I did just notice this style and couldn’t figure out where it’s coming from. This is a really bad design practice, IMO. WP should have just added a widget setting with the style in it rather than hardcoding it like that.

  7. BTW, your solution didn’t work for me either.

    After debugging the core code, I found that I need to replace the filter name with “WP_Widget_Recent_Commentsrecent_comments_style25” in both remove_filter() and has_filter() calls.

    This is most likely because I’m using WP 2.8 which came out after your initial post.

    The nasty file adding the CSS is in wp-includes/ and is called default-widgets.php.

  8. Thanks for the tutorial.. i was looking for that for my wordpress

    1. Jan – I guess it would depend on the filter you are removing. Some you should not remove unless you know exactly what the filter does, and you are comfortable that you have a valid replacement. This is probably why the codex warns against it.

  9. John

    Thanks, this did bug me! Nice to be able to take it out.


  10. John

    Hey it didn’t work initially but if you use function #10 on this article: http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/
    You can see that they added a random string to the function, I just adjusted your code with the new filter name and it worked fine. Not sure if it changes for each WP install but for me the filter name was:


    1. John – I have no idea what you saw. That article does not have any reference to the recent_comments_style at all. I cannot find any reference to that anywhere on Smashing.

  11. Mike

    This doesn’t seem to work in WP 3.0 with Twenty Ten. Has anyone found an alternative method to get rid of this?

    1. Mike – Haven’t had a chance to look into this for you. I have just put up a new theme, and after upgrading to 3.0.1 too. I have put it on my to-do list for local copy and hopefully will get around to it soon.

    2. Mike – Look inside of your TwentyTen functions.php file. They should have an add_action to remove that styling and should look exactly as I have written in my update above.

  12. The fix for 3.0 is simply to rename wp_widget_recent_comments_style to recent_comments_style in Ronnie’s custom filter above.

    1. Stever – That is almost correct. We need to remove this as an action from widget_init, as opposed to a filter from wp_head in versions prior to 2.8.

      1. I simply renamed things in your original filter and it worked for me in WP 3.0.1

      2. Kewl. It did not work for me though. I think there may be a priority issue involved here too. Not certain about that.

Comments are closed.