[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Navigation Menu functions
File Size: | 1349 lines (44 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. |
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. |
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. |
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. |
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. |
get_registered_nav_menus() X-Ref |
Retrieves all registered navigation menu locations in a theme. return: string[] Associative array of registered navigation menu descriptions keyed |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
_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. |
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. |
update_menu_item_cache( $menu_items ) X-Ref |
Updates post and term caches for all linked objects for a list of menu items. param: WP_Post[] $menu_items Array of menu item post objects. |
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. |
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. |
_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. |
_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. |
_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. |
_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. |
_wp_menus_changed() X-Ref |
Handles menu config after theme change. |
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. |
_wp_reset_invalid_menu_item_parent( $menu_item_data ) X-Ref |
Prevents menu items from being their own parent. Resets menu_item_parent to 0 when the parent is set to the item itself. For use before saving `_menu_item_menu_item_parent` in nav-menus.php. param: array $menu_item_data The menu item data array. return: array The menu item data with reset menu_item_parent. |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |