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 |
---|---|
1066 |
|
1067 | $defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', |
1068 | 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => ''); |
1069 | $r = array_merge($defaults, $r); |
1070 | extract($r); |
1071 |
|
1072 | $key = md5( serialize( $r ) ); |
1073 | if ( $cache = wp_cache_get( 'get_pages', 'page' ) ) |
1074 | if ( isset( $cache[ $key ] ) ) |
1075 | return apply_filters('get_pages', $cache[ $key ], $r ); |
1076 |
|
1077 | $inclusions = ''; |
1078 | if ( !empty($include) ) { |
1079 | $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include |
1080 | $exclude = ''; |
1081 | $meta_key = ''; |
1082 | $meta_value = ''; |
1083 | $incpages = preg_split('/[\s,]+/',$include); |
1084 | if ( count($incpages) ) { |
Line | Code |
1136 |
|
1137 | $query = "SELECT * FROM $wpdb->posts " ; |
1138 | $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; |
1139 | $query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ; |
1140 | $query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ; |
1141 | $query .= $author_query; |
1142 | $query .= " ORDER BY " . $sort_column . " " . $sort_order ; |
1143 |
|
1144 | $pages = $wpdb->get_results($query); |
1145 | $pages = apply_filters('get_pages', $pages, $r); |
1146 |
|
1147 | if ( empty($pages) ) |
1148 | return array(); |
1149 |
|
1150 | // Update cache. |
1151 | update_page_cache($pages); |
1152 |
|
1153 | if ( $child_of || $hierarchical ) |
1154 | $pages = & get_page_children($child_of, $pages); |