以这种方式添加过滤器“ajax\\u query\\u attachments\\u args”,并将URL变量发送到类WP\\u query
默认设置为发送
array(7) {
["orderby"]=> string(4) "date"
["order"]=> string(4) "DESC"
["posts_per_page"]=> string(2) "40"
["paged"]=> string(1) "1"
["post_type"]=> string(10) "attachment"
["post_status"]=> string(15) "inherit,private"
}
在这里,您可以根据自己的喜好进行修改
add_filter( \'ajax_query_attachments_args\', \'my_ajax_query_attachments_args\', 1, 10 );
function my_ajax_query_attachments_args($query) {
$query[\'date_query\'] = array(
array(
\'before\' => "-1 day",
\'inclusive\' => true,
),
);
var_dump($query);
return $query;
}