WordPress at a glance

get_all_page_ids() WP 1.0

Get a list of page IDs.

  • Global. wpdb. $wpdb WordPress database abstraction object.

No Hooks.

Return

Array. List of page IDs.

Usage

get_all_page_ids();

Code of get_all_page_ids: wp-includes/post.php VER 4.9.8

<?php
function get_all_page_ids() {
	global $wpdb;

	$page_ids = wp_cache_get('all_page_ids', 'posts');
	if ( ! is_array( $page_ids ) ) {
		$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
		wp_cache_add('all_page_ids', $page_ids, 'posts');
	}

	return $page_ids;
}

Related Functions

From category: Pages

No comments
    Hello, !     Log In . Register