Filter hook 'content_pagination'

in WP Core File wp-includes/class-wp-query.php at line 4946

View Source

content_pagination

Filter Hook
Description
Filters the "pages" derived from splitting the post content. "Pages" are determined by splitting the post content based on the presence of `` tags.

Hook Information

File Location wp-includes/class-wp-query.php View on GitHub
Hook Type Filter
Line Number 4946

Hook Parameters

Type Name Description
string[] $pages Array of "pages" from the post content split by `` tags.
WP_Post $post Current post object.

Usage Examples

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

function my_custom_filter($pages, $post) {
    // Your custom filtering logic here
    return $pages;
}

Source Code Context

wp-includes/class-wp-query.php:4946 - How this hook is used in WordPress core
<?php
4941  		 * @since 4.4.0
4942  		 *
4943  		 * @param string[] $pages Array of "pages" from the post content split by `<!-- nextpage -->` tags.
4944  		 * @param WP_Post  $post  Current post object.
4945  		 */
4946  		$pages = apply_filters( 'content_pagination', $pages, $post );
4947  
4948  		$numpages = count( $pages );
4949  
4950  		if ( $numpages > 1 ) {
4951  			if ( $page > 1 ) {

PHP Documentation

<?php
/**
		 * Filters the "pages" derived from splitting the post content.
		 *
		 * "Pages" are determined by splitting the post content based on the presence
		 * of `<!-- nextpage -->` tags.
		 *
		 * @since 4.4.0
		 *
		 * @param string[] $pages Array of "pages" from the post content split by `<!-- nextpage -->` tags.
		 * @param WP_Post  $post  Current post object.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-query.php
Related Hooks

Related hooks will be displayed here in future updates.