content_pagination
云策文档标注
概述
content_pagination 是一个 WordPress 过滤器,用于修改通过 <!--nextpage--> 标签分割文章内容后生成的“页面”数组。它允许开发者在文章分页过程中自定义页面内容。
关键要点
- 过滤器名称:content_pagination
- 参数:$pages(字符串数组,由 <!--nextpage--> 标签分割的文章内容页面)和 $post(WP_Post 对象,当前文章)
- 用途:在 WP_Query::generate_postdata() 中调用,用于生成文章数据时的分页处理
- 引入版本:4.4.0
原文内容
Filters the “pages” derived from splitting the post content.
Description
“Pages” are determined by splitting the post content based on the presence of <!-- nextpage --> tags.
Parameters
$pagesstring[]-
Array of “pages” from the post content split by
<!-- nextpage -->tags. $postWP_Post-
Current post object.
Source
$pages = apply_filters( 'content_pagination', $pages, $post );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |