Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_pages

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
1993           'authors' => ''
1994      );
1995
1996      $r = wp_parse_args( $args, $defaults );
1997      extract( $r, EXTR_SKIP );
1998
1999      $key = md5( serialize( $r ) );
2000      if ( $cache = wp_cache_get( 'get_pages', 'posts' ) )
2001           if ( isset( $cache[ $key ] ) )
2002                return apply_filters('get_pages', $cache[ $key ], $r );
2003
2004      $inclusions = '';
2005      if ( !empty($include) ) {
2006           $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
2007           $exclude = '';
2008           $meta_key = '';
2009           $meta_value = '';
2010           $hierarchical = false;
2011           $incpages = preg_split('/[\s,]+/',$include);
 
Line Code
2077
2078      }
2079      $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where ";
2080      $query .= $author_query;
2081      $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
2082
2083      $pages = $wpdb->get_results($query);
2084
2085      if ( empty($pages) )
2086           return apply_filters('get_pages', array(), $r);
2087
2088      // Update cache.
2089      update_page_cache($pages);
2090
2091      if ( $child_of || $hierarchical )
2092           $pages = & get_page_children($child_of, $pages);
2093
2094      $cache[ $key ] = $pages;
2095      wp_cache_set( 'get_pages', $cache, 'posts' );
2096
2097      $pages = apply_filters('get_pages', $pages, $r);
2098
2099      return $pages;
2100 }
2101
2102 //
2103 // Attachment functions
2104 //
2105
2106 /**