Exclude specific post from Recent Post widget (1 post)

  1. ganghiss
    Posted 3 years ago #

    I'm trying to remove a specific post, using post ID, from displaying in the default Recent Posts widget. Is there an exclude instance or agument to use? Also, not sure I'm calling the_widget and wp_widget_recent_posts correctly. Below is my screwy attempt in functions.php.

    function custom_recent_post_exclude($data) {
    	$data = array(
    	'widget' => wp_widget_recent_posts,
    	'instance' => 'exclude=45'
    	return $data;
    add_filter( 'the_widget', 'custom_recent_post_exclude', 999 );

Topic Closed

This topic has been closed to new replies.

About this Topic