get_all_page_ids()

You are here:

get_all_page_ids()

Get a list of page IDs.

Return Return

(string[]) List of page IDs as strings.


Top ↑

Source Source

File: wp-includes/post.php

5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
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;
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.
Was this article helpful?
Dislike 0
Views: 4