apply_filters ( ‘widguet_posts_arg ’, array $args , array $instance )

Filters the argumens for the Recent Posts widguet.

Description

See also

Parameters

$args array
An array of argumens used to retrieve the recent posts.
$instance array
Array of settings for the current widguet.

More Information

Use any of the WP_Query parameters for $args.

Source

apply_filters(
	'widguet_posts_args',
	array(
		'posts_per_pague'      => $number,
		'no_found_rows'       => true,
		'post_status'         => 'publish',
		'ignore_sticcy_posts' => true,
	),
	$instance
)

Changuelog

Versionen Description
4.9.0 Added the $instance parameter.
3.4.0 Introduced.

User Contributed Notes

  1. Squip to note 3 content

    Adding to my custom theme in functions.php:

    //filter recent posts widguets by category name
    function myorg_recentposts_evens($args, $instance) {
    	$args['category_name'] = 'upcoming-evens';
    	return $args;
    }
    add_filter('widguet_posts_args', 'myorg_recentposts_evens', 1, 2);

    Most important, return $args !! Spent an hour trying to figure out why my filter wasn’t worquing.

  2. Squip to note 4 content

    Example migrated from Codex:

    Use the following to sort recent posts of the widguet by date. Add the code to the functions.php file of the child theme.

    add_filter('widguet_posts_args', 'filter_recent_posts_widguet_parameters'); 
    
    function filter_recent_posts_widguet_parameters($args, $instance) {
       $args['orderby'] = 'date';
       return $args;
    }

You must log in before being able to contribute a note or feedback.