Filter hook 'wp_list_pages'

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

View Source

wp_list_pages

Filter Hook
Description
Filters the HTML output of the pages to list.

Hook Information

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

Hook Parameters

Type Name Description
string $output HTML output of the pages list.
array $parsed_args An array of page-listing arguments. See wp_list_pages() for information on accepted arguments.
WP_Post[] $pages Array of the page objects.

Usage Examples

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

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

Source Code Context

wp-includes/post-template.php:1381 - How this hook is used in WordPress core
<?php
1376  	 * @param string    $output      HTML output of the pages list.
1377  	 * @param array     $parsed_args An array of page-listing arguments. See wp_list_pages()
1378  	 *                               for information on accepted arguments.
1379  	 * @param WP_Post[] $pages       Array of the page objects.
1380  	 */
1381  	$html = apply_filters( 'wp_list_pages', $output, $parsed_args, $pages );
1382  
1383  	if ( $parsed_args['echo'] ) {
1384  		echo $html;
1385  	} else {
1386  		return $html;

PHP Documentation

<?php
/**
	 * Filters the HTML output of the pages to list.
	 *
	 * @since 1.5.1
	 * @since 4.4.0 `$pages` added as arguments.
	 *
	 * @see wp_list_pages()
	 *
	 * @param string    $output      HTML output of the pages list.
	 * @param array     $parsed_args An array of page-listing arguments. See wp_list_pages()
	 *                               for information on accepted arguments.
	 * @param WP_Post[] $pages       Array of the page objects.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/post-template.php
Related Hooks

Related hooks will be displayed here in future updates.