Last active
December 12, 2022 08:50
-
-
Save wpchannel/6821b07fe7549ac41eb7643168de1ccb to your computer and use it in GitHub Desktop.
Filter WordPress Recent Posts Widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! The
operator
made all the difference.