Display or retrieve list of pages with optional home link.

The arguments are listed below and part of the arguments are for {@link wp_list_pages()} function. Check that function for more info on those arguments.

  • sort_column – How to sort the list of pages. Defaults to ‘menu_order, post_title’. Use column for posts table.
  • menu_class – Class to use for the div ID which contains the page list. Defaults to ‘menu’.
  • echo – Whether to echo list or return it. Defaults to echo.
  • link_before – Text before show_home argument text.
  • link_after – Text after show_home argument text.
  • show_home – If you set this argument, then it will display the link to the home page. The show_home argument really just needs to be set to the value of the text of the link.


wp_page_menu( $args = array() )
Default: array()


(string) html menu


function wp_page_menu( $args = array() ) {
	$defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
	$args = wp_parse_args( $args, $defaults );

	 * Filter the arguments used to generate a page-based menu.
	 * @since 2.7.0
	 * @see wp_page_menu()
	 * @param array $args An array of page menu arguments.
	$args = apply_filters( 'wp_page_menu_args', $args );

	$menu = '';

	$list_args = $args;

	// Show Home in the menu
45 more lines...
WP Trac GitHub

Link here