wpseek.com
WordPress开发者和主题制作者的搜索引擎
_wp_personal_data_cleanup_requests is private and should not be used in themes or plugins directly.
_wp_personal_data_cleanup_requests › WordPress Function
Since4.9.6
已弃用n/a
› _wp_personal_data_cleanup_requests ( 没有参数 )
| 访问: |
|
| 定义在: |
|
| 文档: |
Cleans up failed and expired requests before displaying the list table.
源码
function _wp_personal_data_cleanup_requests() {
/** This filter is documented in wp-includes/user.php */
$expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
$requests_query = new WP_Query(
array(
'post_type' => 'user_request',
'posts_per_page' => -1,
'post_status' => 'request-pending',
'fields' => 'ids',
'date_query' => array(
array(
/*
* The local-time column must be used here, not post_modified_gmt:
* WP_Date_Query resolves relative date strings like "N seconds ago"
* in the site's timezone, so comparing against the GMT column would
* shift the expiry window by the site's UTC offset.
*/
'column' => 'post_modified',
'before' => $expires . ' seconds ago',
),
),
)
);
$request_ids = $requests_query->posts;
foreach ( $request_ids as $request_id ) {
wp_update_post(
array(
'ID' => $request_id,
'post_status' => 'request-failed',
'post_password' => '',
)
);
}
}