Skip to content

Instantly share code, notes, and snippets.

@wpchannel
Last active December 12, 2022 08:50
Show Gist options
  • Save wpchannel/6821b07fe7549ac41eb7643168de1ccb to your computer and use it in GitHub Desktop.
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(
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');
@rosiel
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