2

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 ;)

5

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;
}
  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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