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'm trying to hide a post from the 'Recent Posts' widget in the sidebar. I know I can do this with the 'Special Recent Posts' plugin, but that plugin really uses up a lot of resources.

I've got the 'WP Hide Post' plugin, but that doesn't hide a post from the recent posts widget.

So how do I go about doing this?

I don't know any coding, so if you do give me any code, you'd have to tell me where to place it.

Thanks ;)

share|improve this question

You can exclude posts from the recent posts widget via the widget_posts_args filter:

add_filter( 'widget_posts_args', 'exclude_posts_wpse_103570');

function exclude_posts_wpse_103570( $args ){
    // post ID's to exclude:
    $args['post__not_in'] = array( 123, 234, 345 );
    return $args;
share|improve this answer
Pasted the above into my custom_functions.php file, and it Worked like magic! Thank you birgire. – Sammie Jun 20 '13 at 11:30

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.