WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my own "Recent Posts" menu, but its not currently implemented as a Widget. I'm just including it in sidebar.php.

I had to "roll my own" so to speak in order to filter the menu of certain categories whose posts I don't want to appear in the menu.

Would it be possible, via functions.php, to filter the default "Recent Posts: widget's menu items in order to exclude posts belonging to a specific category?

If so, I'd really be grateful for an example.

share|improve this question
up vote 0 down vote accepted

Unfortunately there is no filter for WP_Query args in WP_Widget_Recent_Posts class, so it's impossible. I think there are plugins for recent post that have category filtering option - http://wordpress.org/extend/plugins/tags/recent-posts

share|improve this answer
Thanks Mamaduka. I believe that my approach will then need to be to clone the recent posts widget and create my own version of it. I've posted a new question with that in mind. – N2Mystic Oct 3 '11 at 15:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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