Skip to content

Instantly share code, notes, and snippets.

Last active December 12, 2022 08:50
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wpchannel/6821b07fe7549ac41eb7643168de1ccb to your computer and use it in GitHub Desktop.
Filter WordPress Recent Posts Widget
function wpc_filter_recent_posts_widget_parameters($params) {
$params['orderby'] = 'date';
$params['tax_query'] = 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');
Copy link


Copy link

rosiel 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