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 |
|---|---|
| 836 | |
| 837 | if ( ! isset( $menu_item->description ) ) { |
| 838 | /** |
| 839 | * Filters a navigation menu item's description. |
| 840 | * |
| 841 | * @since 3.0.0 |
| 842 | * |
| 843 | * @param string $description The menu item description. |
| 844 | */ |
| 845 | $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) ); |
| 846 | } |
| 847 | |
| 848 | $menu_item->classes = ! isset( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes; |
| 849 | $menu_item->xfn = ! isset( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn; |
| 850 | } else { |
| 851 | $menu_item->db_id = 0; |
| 852 | $menu_item->menu_item_parent = 0; |
| 853 | $menu_item->object_id = (int) $menu_item->ID; |
| 854 | $menu_item->type = 'post_type'; |
| Line | Code |
| 864 | |
| 865 | $menu_item->title = $menu_item->post_title; |
| 866 | $menu_item->url = get_permalink( $menu_item->ID ); |
| 867 | $menu_item->target = ''; |
| 868 | |
| 869 | /** This filter is documented in wp-includes/nav-menu.php */ |
| 870 | $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' ); |
| 871 | |
| 872 | /** This filter is documented in wp-includes/nav-menu.php */ |
| 873 | $menu_item->description = apply_filters( 'nav_menu_description', '' ); |
| 874 | $menu_item->classes = array(); |
| 875 | $menu_item->xfn = ''; |
| 876 | } |
| 877 | } elseif ( isset( $menu_item->taxonomy ) ) { |
| 878 | $menu_item->ID = $menu_item->term_id; |
| 879 | $menu_item->db_id = 0; |
| 880 | $menu_item->menu_item_parent = 0; |
| 881 | $menu_item->object_id = (int) $menu_item->term_id; |
| 882 | $menu_item->post_parent = (int) $menu_item->parent; |