Filter hook 'wp_page_menu'

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

View Source

wp_page_menu

Filter Hook
Description
Filters the HTML output of a page-based menu.

Hook Information

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

Hook Parameters

Type Name Description
string $menu The HTML output.
array $args An array of arguments. See wp_page_menu() for information on accepted arguments.

Usage Examples

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

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

Source Code Context

wp-includes/post-template.php:1537 - How this hook is used in WordPress core
<?php
1532  	 *
1533  	 * @param string $menu The HTML output.
1534  	 * @param array  $args An array of arguments. See wp_page_menu()
1535  	 *                     for information on accepted arguments.
1536  	 */
1537  	$menu = apply_filters( 'wp_page_menu', $menu, $args );
1538  
1539  	if ( $args['echo'] ) {
1540  		echo $menu;
1541  	} else {
1542  		return $menu;

PHP Documentation

<?php
/**
	 * Filters the HTML output of a page-based menu.
	 *
	 * @since 2.7.0
	 *
	 * @see wp_page_menu()
	 *
	 * @param string $menu The HTML output.
	 * @param array  $args An array of arguments. See wp_page_menu()
	 *                     for information on accepted arguments.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post-template.php
Related Hooks

Related hooks will be displayed here in future updates.