WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
917 |
|
918 | if ( ! isset( $menu_item->description ) ) { |
919 | /** |
920 | * Filters a navigation menu item's description. |
921 | * |
922 | * @since 3.0.0 |
923 | * |
924 | * @param string $description The menu item description. |
925 | */ |
926 | $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) ); |
927 | } |
928 |
|
929 | $menu_item->classes = ! isset( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes; |
930 | $menu_item->xfn = ! isset( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn; |
931 | } else { |
932 | $menu_item->db_id = 0; |
933 | $menu_item->menu_item_parent = 0; |
934 | $menu_item->object_id = (int) $menu_item->ID; |
935 | $menu_item->type = 'post_type'; |
Line | Code |
945 |
|
946 | $menu_item->title = $menu_item->post_title; |
947 | $menu_item->url = get_permalink( $menu_item->ID ); |
948 | $menu_item->target = ''; |
949 |
|
950 | /** This filter is documented in wp-includes/nav-menu.php */ |
951 | $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' ); |
952 |
|
953 | /** This filter is documented in wp-includes/nav-menu.php */ |
954 | $menu_item->description = apply_filters( 'nav_menu_description', '' ); |
955 | $menu_item->classes = array(); |
956 | $menu_item->xfn = ''; |
957 | } |
958 | } elseif ( isset( $menu_item->taxonomy ) ) { |
959 | $menu_item->ID = $menu_item->term_id; |
960 | $menu_item->db_id = 0; |
961 | $menu_item->menu_item_parent = 0; |
962 | $menu_item->object_id = (int) $menu_item->term_id; |
963 | $menu_item->post_parent = (int) $menu_item->parent; |