Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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
    
ok great to hear that, please accept the answer (see meta.stackexchange.com/a/5235) to close the question, thanks ;-) –  birgire Jun 20 '13 at 11:35

Your Answer

 
discard

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.