wp_page_menu( array|string $args = array() )

Displays or retrieves a list of pages with an optional home link.

25 related functions found for: wp_page_menu

Top ↑

Related terms found for this post

wp-parser-related-wordsmenu, menus, page, post-template-php, post-typ, post-type, wp-includes, wp-page
wp-parser-packageTemplate, WordPress

Top ↑

Terms Used Terms Used

Terms used in the related posts query

  • menu
  • menus
  • page
  • post-template-php
  • post-typ
  • post-type
  • Template
  • wp-includes
  • wp-includes/post-template.php
  • wp-page
  • template

Top ↑

Description Description

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

Top ↑

Parameters Parameters


(array|string) (Optional) Arguments to generate a page menu. See wp_list_pages() for additional arguments.

  • 'sort_column'
    (string) How to short the list of pages. Accepts post column names. Default 'menu_order, post_title'.
  • 'menu_id'
    (string) ID for the div containing the page list. Default is empty string.
  • 'menu_class'
    (string) Class to use for the element containing the page list. Default 'menu'.
  • 'container'
    (string) Element to use for the element containing the page list. Default 'div'.
  • 'echo'
    (bool) Whether to echo the list or return it. Accepts true (echo) or false (return). Default true.
  • 'show_home'
    (int|bool|string) Whether to display the link to the home page. Can just enter the text you'd like shown for the home link. 1|true defaults to 'Home'.
  • 'link_before'
    (string) The HTML or text to prepend to $show_home text.
  • 'link_after'
    (string) The HTML or text to append to $show_home text.
  • 'before'
    (string) The HTML or text to prepend to the menu. Default is '<ul>'.
  • 'after'
    (string) The HTML or text to append to the menu. Default is '</ul>'.
  • 'item_spacing'
    (string) Whether to preserve whitespace within the menu's HTML. Accepts 'preserve' or 'discard'. Default 'discard'.
  • 'walker'
    (Walker) Walker instance to use for listing pages. Default empty (Walker_Page).

Default value: array()

Top ↑

Return Return

(string|void) HTML menu

Top ↑

Source Source

File: wp-includes/post-template.php


Top ↑

Changelog Changelog

Version Description
4.7.0 Added the item_spacing argument.
4.4.0 Added menu_id, container, before, after, and walker arguments.
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.