WordPress filter hook · part of WordPress core
widget_posts_args
A WordPress core filter that 38 plugins also fire themselves, running on 13K+ sites between them.
“Filter the arguments for the Recent Posts widget.”
How to use widget_posts_args
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'widget_posts_args', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Argument names come from xili-language's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
38 plugins that fire widget_posts_args
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WCFM Marketplace10,000+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'author' => $store_id ), $instance )includes/store-widgets/class-wcfmmp-widget-store-recent-articles.php:68 -
xili-language600+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )xili-includes/xili-language-widgets.php:144 -
ACF Recent Posts Widget500+ installs
apply_filters( 'widget_posts_args', $query_args )classes/acf-widget-widget.php:147 -
core plugin for kitestudio themes300+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ) )includes/widgets/widget-recent-posts.php:18 -
Recent Posts Widget Advanced300+ installs
apply_filters( 'widget_posts_args', $query, $instance )includes/query.php:87 -
Administrator Z200+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'post_type' => $post_type, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance )src/Widget/Adminz_RecentPosts.php:30 -
Recent Post Widget Thumbnail100+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )widgets/recent-post-core.php:56 -
OnionBuzz100+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'post_type' => $post_type ) )lib/Widgets/WP_Onionbuzz_Recent_Posts.php:74 -
Featured Posts Pro100+ installs
apply_filters( 'widget_posts_args', $postArgs )includes/class-featured_posts_pro.php:311 -
Pro Recent Post Widget100+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true,'cat'=>$post_category,'post__not_in'=>$exclude_post ) )pro-recent-post-widget.php:40 -
Listings Post Type Enable100+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number,'post_type'=>'listing', 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )listings.php:170 -
Minimalistic Event Manager60+ installs
apply_filters( 'widget_posts_args', array( 'post_type' => $post_types, 'posts_per_page' => -1, 'meta_key' => '_mem_start_date', 'meta_value' => $mem_180day_iso, 'meta_compare' => '>=', 'orderby' => 'meta_value', 'order' => 'DESC', 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ) )widgets/event-list.php:187 -
Custom Content60+ installs
apply_filters( 'widget_posts_args', array( 'post_type' => 'custom-content', 'post__in' => array($instance['showescontents']), ) )inc/custom-content-widget.php:28 -
Epic Tap Widgets20+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )includes/widgets/widget-recent-post.php:55 -
IG Portfolio20+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'post_type' => 'project', ) )extra/ig-portfolio-project-widget.php:23 -
Sogo Calendar Widget20+ installs
apply_filters( 'widget_posts_args', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => $meta_filed, 'value' => array($month_start, $month_end), 'compare' => 'between' ) ) ) )plugin.php:253 -
RSVPMaker for Toastmasters10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'category_name' => 'members-only', 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ) )core.php:16058 -
List of User’s Posts Widget10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'author' =>$current_user->ID ) )louposts.php:94 -
Custom News Widget10+ installs
apply_filters( 'widget_posts_args', array( 'post_type' => 'news', 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance )includes/class-cnw-widget.php:58 -
Blesk Companion10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )widgets/latest_news.php:70 -
JS Widgets10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $instance['number'], 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'update_post_meta_cache' => false, 'update_term_meta_cache' => false, ) )core-adapter-widgets/recent-posts/class.php:82 -
Members Only Posts10+ installs
apply_filters( 'widget_posts_args', $qargs )members-only.php:114 -
Forethemes Functions10+ installs
apply_filters( 'widget_posts_args', $get_post_args )widgets/forethemes-custom-post-widget.php:83 -
Pro Related Post Widget10+ installs
apply_filters( 'widget_posts_args', $arg )pro-related-post-widget.php:57 -
HTML Classified Recent Posts & Comments Widgets10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )html-classified-recent-post-comments-widgets.php:55 -
Switch Last Posts Widget10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'cat' => $categorieToUse ) )switch-last-posts-widget.php:124 -
Gallery Recent Posts10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number_posts_pic, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'meta_query' => array( array( 'key' => '_thumbnail_id' ) ) ) )gallery_recent_posts.php:66 -
WP Immo10+ installs
apply_filters( 'widget_posts_args', $args_query )includes/wpimmo-widgets.php:72 -
User Photo10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )widget-latestarticles.php:30 -
WP All Post Type Widget10+ installs
apply_filters( 'widget_posts_args', $post_args )classes/class-widget.php:58 -
Manage Issue Based Magazine (Multi-language)10+ installs
apply_filters( 'widget_posts_args', $featured_artcile_args )mim-widgets.php:854 -
SOGO Author’s Recent Posts10+ installs
apply_filters( 'widget_posts_args', array( 'post_type'=> $post_type, 'posts_per_page' => $number, 'author' => $user->ID, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )plugin.php:95 -
GA-PVcounter10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => GA_PVC_RECENTPOSTS, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )GA-PVwidget.php:315 -
Stick Post Widget10+ installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => false,'post__in' =>$sticky_posts) )stick-post-widget.php:43 -
Lenxel AI LMSFewer than 10 installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance )widgets/recent_posts.php:68 -
Share Theme PluginFewer than 10 installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )widgets/share-theme-plugin-recent-post-widget.php:40 -
WP News Photo GalleryFewer than 10 installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'post_type' => array('wpnpg', 'ignore_sticky_posts' => true ) ) )lib/widget.php:50 -
Lingenio Translation ServiceFewer than 10 installs
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) )pg_widgets/default_widgets_new.php:44
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.