get_all_page_ids() WP 1.0
Get a list of page IDs.
No Hooks.
Return
String[]. List of page IDs as strings.
Usage
get_all_page_ids();
Notes
- Global. wpdb. $wpdb WordPress database abstraction object.
Changelog
Since 2.0.0 | Introduced. |
Code of get_all_page_ids() get all page ids WP 5.6
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;
}