xxxxxxxxxx
add_action( 'pre_get_posts', 'wpshout_fundraiser_recent_posts' );
function wpshout_fundraiser_recent_posts( $query ) {
// Do nothing if not on Fundraiser page
if( ! is_page( 'Fundraiser' ) ) :
return;
endif;
// Make sure we're talking to the WP_Query
// generated by the Recent Posts widget
if( ! is_main_query() &&
$query->query[ 'no_found_rows' ] === true &&
$query->query[ 'post_type' ] === NULL
) :
// Fetch only posts tagged with "fundraiser"
$taxquery = array(
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => array( 'fundraiser' ),
)
);
$query->set( 'tax_query', $taxquery );
endif;
}