Filter hook 'get_pages'

in WP Core File wp-includes/post.php at line 6502

View Source

get_pages

Filter Hook
Description
Filters the retrieved list of pages.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 6502

Hook Parameters

Type Name Description
WP_Post[] $pages Array of page objects.
array $parsed_args Array of get_pages() arguments.

Usage Examples

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

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

Source Code Context

wp-includes/post.php:6502 - How this hook is used in WordPress core
<?php
6497  	 * @since 2.1.0
6498  	 *
6499  	 * @param WP_Post[] $pages       Array of page objects.
6500  	 * @param array     $parsed_args Array of get_pages() arguments.
6501  	 */
6502  	return apply_filters( 'get_pages', $pages, $parsed_args );
6503  }
6504  
6505  //
6506  // Attachment functions.
6507  //

PHP Documentation

<?php
/**
	 * Filters the retrieved list of pages.
	 *
	 * @since 2.1.0
	 *
	 * @param WP_Post[] $pages       Array of page objects.
	 * @param array     $parsed_args Array of get_pages() arguments.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.