Filter hook 'dashboard_recent_posts_query_args'

in WP Core File wp-admin/includes/dashboard.php at line 996

View Source

dashboard_recent_posts_query_args

Filter Hook
Description
Filters the query arguments used for the Recent Posts widget.

Hook Information

File Location wp-admin/includes/dashboard.php View on GitHub
Hook Type Filter
Line Number 996

Hook Parameters

Type Name Description
array $query_args The arguments passed to WP_Query to produce the list of posts.

Usage Examples

Basic Usage
<?php
// Hook into dashboard_recent_posts_query_args
add_filter('dashboard_recent_posts_query_args', 'my_custom_filter', 10, 1);

function my_custom_filter($query_args) {
    // Your custom filtering logic here
    return $query_args;
}

Source Code Context

wp-admin/includes/dashboard.php:996 - How this hook is used in WordPress core
<?php
 991  	 *
 992  	 * @since 4.2.0
 993  	 *
 994  	 * @param array $query_args The arguments passed to WP_Query to produce the list of posts.
 995  	 */
 996  	$query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args );
 997  
 998  	$posts = new WP_Query( $query_args );
 999  
1000  	if ( $posts->have_posts() ) {
1001  

PHP Documentation

<?php
/**
	 * Filters the query arguments used for the Recent Posts widget.
	 *
	 * @since 4.2.0
	 *
	 * @param array $query_args The arguments passed to WP_Query to produce the list of posts.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/includes/dashboard.php
Related Hooks

Related hooks will be displayed here in future updates.