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