WordPress filter hook · part of WordPress core

wp_list_pages

A WordPress core filter that 13 plugins also fire themselves, running on 11K+ sites between them.

“Filters the HTML output of the pages to list.”

How to use wp_list_pages

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wp_list_pages', function( $output, $r ) {
	// Change $output here.
	return $output;
}, 10, 2 );

Argument names come from GNA Post Order's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

13 plugins that fire wp_list_pages

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Advanced Sidebar Menu icon Advanced Sidebar Menu10,000+ installs apply_filters( 'wp_list_pages', $this->output, $this->args, $pages ) src/List_Pages.php:281
  2. WPComplete icon WPComplete1,000+ installs apply_filters( 'wp_list_pages', $output, $r, $pages ) public/class-wpcomplete-public.php:1763
  3. Sitemap with woocommerce icon Sitemap with woocommerce100+ installs apply_filters( 'wp_list_pages', $output, $r, $pages ) index.php:289
  4. GNA Post Order icon GNA Post Order100+ installs apply_filters( 'wp_list_pages', $output, $r ) admin/gna-post-order-admin-sortpage-menu.php:209
  5. Documentation icon Documentation100+ installs apply_filters( 'wp_list_pages', $output, $r ) lib/views/class-documentation-renderer.php:487
  6. Custom Page Menus icon Custom Page Menus60+ installs apply_filters( 'wp_list_pages', $output, $r ) template-tag.php:49
  7. All Round Order icon All Round Order30+ installs apply_filters( 'wp_list_pages', $output, $r ) 1.1/all-round-order.php:253
  8. WP YUI Menu icon WP YUI Menu10+ installs apply_filters( 'wp_list_pages', $output ) wp-yui-menu.php:72
  9. Custom Post Type Privacy icon Custom Post Type Privacy10+ installs apply_filters( 'wp_list_pages', $out ) cpt-sentry-widgets.php:40
  10. SF Bootstrap Menu icon SF Bootstrap Menu10+ installs apply_filters( 'wp_list_pages', $output ) sf-menu-widget.php:257
  11. Easy Post Re-Order icon Easy Post Re-Order10+ installs apply_filters( 'wp_list_pages', $output, $r ) files/easysoftonic-my-easy-class.php:398
  12. Tagged Sitemap icon Tagged Sitemap10+ installs apply_filters( 'wp_list_pages', $output, $r ) functions.php:43
  13. MindValley Show Last Edited icon MindValley Show Last EditedFewer than 10 installs apply_filters( 'wp_list_pages', $output, $r ) mindvalley-last-edited-post.php:158

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.