get_all_page_ids

Get a list of page IDs.

Description

(array) get_all_page_ids(); 

Returns (array)

List of page IDs.


Usage

  1. if ( !function_exists( 'get_all_page_ids' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_all_page_ids(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function get_all_page_ids() { 
  2. global $wpdb; 
  3.  
  4. $page_ids = wp_cache_get('all_page_ids', 'posts'); 
  5. if ( ! is_array( $page_ids ) ) { 
  6. $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); 
  7. wp_cache_add('all_page_ids', $page_ids, 'posts'); 
  8.  
  9. return $page_ids;