Decorates a menu item object with the shared navigation menu item properties.
Properties:
*- db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn’t exist).
*- object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories.
*- type: The family of objects originally represented, such as “post_type” or “taxonomy.”
*- object: The type of object originally represented, such as “category,” “post”, or “attachment.”
*- type_label: The singular label used to describe this type of menu item.
*- post_parent: The DB ID of the original object’s parent object, if any (0 otherwise).
*- menu_item_parent: The DB ID of the nav_menu_item that is this item’s menu parent, if any. 0 otherwise.
*- url: The URL to which this menu item points.
*- title: The title of this menu item.
*- target: The target attribute of the link element for this menu item.
*- 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.
*- xfn: The XFN relationship expressed in the link of this menu item.
*- description: The description of this menu item.
Signature
wp_setup_nav_menu_item( $menu_item )
- menu_item
- (object) The menu item to modify.
Return
(object) $menu_item The menu item with standard menu item properties.
Source
WP Trac GitHub Bitbucketfunction wp_setup_nav_menu_item( $menu_item ) { if ( isset( $menu_item->post_type ) ) { if ( 'nav_menu_item' == $menu_item->post_type ) { $menu_item->db_id = (int) $menu_item->ID; $menu_item->menu_item_parent = empty( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ) : $menu_item->menu_item_parent; $menu_item->object_id = empty( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, '_menu_item_object_id', true ) : $menu_item->object_id; $menu_item->object = empty( $menu_item->object ) ? get_post_meta( $menu_item->ID, '_menu_item_object', true ) : $menu_item->object; $menu_item->type = empty( $menu_item->type ) ? get_post_meta( $menu_item->ID, '_menu_item_type', true ) : $menu_item->type; if ( 'post_type' == $menu_item->type ) { $object = get_post_type_object( $menu_item->object ); if ( $object ) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $menu_item->url = get_permalink( $menu_item->object_id );79 more lines...
Link here
-
URL
http://queryposts.com/function/wp_setup_nav_menu_item/ -
HTML
<a href='http://queryposts.com/function/wp_setup_nav_menu_item/'>wp_setup_nav_menu_item()</a> -
Markdown
[wp_setup_nav_menu_item()](http://queryposts.com/function/wp_setup_nav_menu_item/) -
BBCode
[url=http://queryposts.com/function/wp_setup_nav_menu_item/]wp_setup_nav_menu_item()[/url]