[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
Navigation Menu functions
File Size: | 1268 lines (42 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
wp_get_nav_menu_object( $menu ) X-Ref |
Returns a navigation menu object. param: int|string|WP_Term $menu Menu ID, slug, name, or object. return: WP_Term|false Menu object on success, false if $menu param isn't supplied or term does not exist. since: 3.0.0 |
is_nav_menu( $menu ) X-Ref |
Determines whether the given ID is a navigation menu. Returns true if it is; false otherwise. param: int|string|WP_Term $menu Menu ID, slug, name, or object of menu to check. return: bool Whether the menu exists. since: 3.0.0 |
register_nav_menus( $locations = array() X-Ref |
Registers navigation menu locations for a theme. param: string[] $locations Associative array of menu location identifiers (like a slug) and descriptive text. since: 3.0.0 |
unregister_nav_menu( $location ) X-Ref |
Unregisters a navigation menu location for a theme. param: string $location The menu location identifier. return: bool True on success, false on failure. since: 3.1.0 |
register_nav_menu( $location, $description ) X-Ref |
Registers a navigation menu location for a theme. param: string $location Menu location identifier, like a slug. param: string $description Menu location descriptive text. since: 3.0.0 |
get_registered_nav_menus() X-Ref |
Retrieves all registered navigation menu locations in a theme. return: string[] Associative array of egistered navigation menu descriptions keyed since: 3.0.0 |
get_nav_menu_locations() X-Ref |
Retrieves all registered navigation menu locations and the menus assigned to them. return: int[] Associative array of registered navigation menu IDs keyed by their since: 3.0.0 |
has_nav_menu( $location ) X-Ref |
Determines whether a registered nav menu location has a menu assigned to it. param: string $location Menu location identifier. return: bool Whether location has a menu. since: 3.0.0 |
wp_get_nav_menu_name( $location ) X-Ref |
Returns the name of a navigation menu. param: string $location Menu location identifier. return: string Menu name. since: 4.9.0 |
is_nav_menu_item( $menu_item_id = 0 ) X-Ref |
Determines whether the given ID is a nav menu item. param: int $menu_item_id The ID of the potential nav menu item. return: bool Whether the given ID is that of a nav menu item. since: 3.0.0 |
wp_create_nav_menu( $menu_name ) X-Ref |
Creates a navigation menu. Note that `$menu_name` is expected to be pre-slashed. param: string $menu_name Menu name. return: int|WP_Error Menu ID on success, WP_Error object on failure. since: 3.0.0 |
wp_delete_nav_menu( $menu ) X-Ref |
Deletes a navigation menu. param: int|string|WP_Term $menu Menu ID, slug, name, or object. return: bool|WP_Error True on success, false or WP_Error object on failure. since: 3.0.0 |
wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() X-Ref |
Saves the properties of a menu or create a new menu with those properties. Note that `$menu_data` is expected to be pre-slashed. param: int $menu_id The ID of the menu or "0" to create a new menu. param: array $menu_data The array of menu data. return: int|WP_Error Menu ID on success, WP_Error object on failure. since: 3.0.0 |
wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() X-Ref |
Saves the properties of a menu item or create a new one. The menu-item-title, menu-item-description and menu-item-attr-title are expected to be pre-slashed since they are passed directly to APIs that expect slashed data. param: int $menu_id The ID of the menu. If 0, makes the menu item a draft orphan. param: int $menu_item_db_id The ID of the menu item. If 0, creates a new menu item. param: array $menu_item_data The menu item's data. param: bool $fire_after_hooks Whether to fire the after insert hooks. Default true. return: int|WP_Error The menu item's database ID or WP_Error object on failure. since: 3.0.0 since: 5.9.0 Added the `$fire_after_hooks` parameter. |
wp_get_nav_menus( $args = array() X-Ref |
Returns all navigation menu objects. param: array $args Optional. Array of arguments passed on to get_terms(). return: WP_Term[] An array of menu objects. since: 3.0.0 since: 4.1.0 Default value of the 'orderby' argument was changed from 'none' |
_is_valid_nav_menu_item( $item ) X-Ref |
Determines whether a menu item is valid. param: object $item The menu item to check. return: bool False if invalid, otherwise true. since: 3.2.0 |
wp_get_nav_menu_items( $menu, $args = array() X-Ref |
Retrieves all menu items of a navigation menu. Note: Most arguments passed to the `$args` parameter – save for 'output_key' – are specifically for retrieving nav_menu_item posts from get_posts() and may only indirectly affect the ultimate ordering and content of the resulting nav menu items that get returned from this function. param: int|string|WP_Term $menu Menu ID, slug, name, or object. param: array $args { return: array|false Array of menu items, otherwise false. since: 3.0.0 |
wp_setup_nav_menu_item( $menu_item ) X-Ref |
Decorates a menu item object with the shared navigation menu item properties. Properties: - ID: The term_id if the menu item represents a taxonomy term. - attr_title: The title attribute of the link element for this menu item. - classes: The array of class attribute values for the link element of this menu item. - db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). - description: The description of this menu item. - menu_item_parent: The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. - object: The type of object originally represented, such as 'category', 'post', or 'attachment'. - object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. - post_parent: The DB ID of the original object's parent object, if any (0 otherwise). - post_title: A "no title" label if menu item represents a post that lacks a title. - target: The target attribute of the link element for this menu item. - title: The title of this menu item. - type: The family of objects originally represented, such as 'post_type' or 'taxonomy'. - type_label: The singular label used to describe this type of menu item. - url: The URL to which this menu item points. - xfn: The XFN relationship expressed in the link of this menu item. - _invalid: Whether the menu item represents an object that no longer exists. param: object $menu_item The menu item to modify. return: object The menu item with standard menu item properties. since: 3.0.0 |
wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) X-Ref |
Returns the menu items associated with a particular object. param: int $object_id Optional. The ID of the original object. Default 0. param: string $object_type Optional. The type of object, such as 'post_type' or 'taxonomy'. param: string $taxonomy Optional. If $object_type is 'taxonomy', $taxonomy is the name return: int[] The array of menu item IDs; empty array if none. since: 3.0.0 |
_wp_delete_post_menu_item( $object_id ) X-Ref |
Callback for handling a menu item when its original object is deleted. param: int $object_id The ID of the original object being trashed. since: 3.0.0 |
_wp_delete_tax_menu_item( $object_id, $tt_id, $taxonomy ) X-Ref |
Serves as a callback for handling a menu item when its original object is deleted. param: int $object_id The ID of the original object being trashed. param: int $tt_id Term taxonomy ID. Unused. param: string $taxonomy Taxonomy slug. since: 3.0.0 |
_wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) X-Ref |
Automatically add newly published page objects to menus with that as an option. param: string $new_status The new status of the post object. param: string $old_status The old status of the post object. param: WP_Post $post The post object being transitioned from one status to another. since: 3.0.0 |
_wp_delete_customize_changeset_dependent_auto_drafts( $post_id ) X-Ref |
Deletes auto-draft posts associated with the supplied changeset. param: int $post_id Post ID for the customize_changeset. since: 4.8.0 |
_wp_menus_changed() X-Ref |
Handles menu config after theme change. since: 4.9.0 |
wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) X-Ref |
Maps nav menu locations according to assignments in previously active theme. param: array $new_nav_menu_locations New nav menu locations assignments. param: array $old_nav_menu_locations Old nav menu locations assignments. return: array Nav menus mapped to new nav menu locations. since: 4.9.0 |
Generated: Wed Oct 16 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |