wp_sitemaps_users_pre_url_list
云策文档标注
概述
wp_sitemaps_users_pre_url_list 是一个 WordPress 过滤器钩子,用于在生成用户站点地图 URL 列表之前进行干预。通过返回非空值,可以短路默认生成过程,直接使用自定义值。
关键要点
- 这是一个过滤器钩子,允许在生成用户站点地图 URL 列表前修改或替换数据。
- 返回非空值(如数组)将跳过默认生成,直接使用返回的值。
- 参数包括 $url_list(URL 列表,默认为 null)和 $page_num(结果页码)。
- 在 WP_Sitemaps_Users::get_url_list() 方法中使用,用于获取用户站点地图的 URL 列表。
- 自 WordPress 5.5.0 版本引入。
代码示例
$url_list = apply_filters(
'wp_sitemaps_users_pre_url_list',
null,
$page_num
);
原文内容
Filters the users URL list before it is generated.
Description
Returning a non-null value will effectively short-circuit the generation, returning that value instead.
Parameters
$url_listarray[]|null-
The URL list. Default null.
$page_numint-
Page of results.
Source
$url_list = apply_filters(
'wp_sitemaps_users_pre_url_list',
null,
$page_num
);
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |