Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filter WordPress Recent Posts Widget
function wpc_filter_recent_posts_widget_parameters($params) {
$params['orderby'] = 'date';
$params['tax_query'] = array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array('post-format-movie', 'post-format-aside'),
'operator' => 'NOT IN'
)
);
return $params;
}
add_filter('widget_posts_args', 'wpc_filter_recent_posts_widget_parameters');
@blogsoever

This comment has been minimized.

Copy link

commented May 2, 2018

Thanks.

@rosiel

This comment has been minimized.

Copy link

commented Jul 20, 2019

Thanks! The operator made all the difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.