widget_posts_args WordPress Filter Hook

The widget_posts_args hook is used to modify the arguments used in WP_Query when fetching posts to display in a widget. This hook can be used to change the number of posts displayed, the order in which they are displayed, or any other arguments supported by WP_Query.

apply_filters( 'widget_posts_args', array $args, array $instance ) #

Filters the arguments for the Recent Posts widget.


Description

Top ↑

See also


Top ↑

Parameters

$args

(array)An array of arguments used to retrieve the recent posts.

$instance

(array)Array of settings for the current widget.


Top ↑

More Information

Use any of the WP_Query parameters for $args.


Top ↑

Source

File: wp-includes/widgets/class-wp-widget-recent-posts.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.9.0Added the $instance parameter.
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.