get_all_page_ids()
Get a list of page IDs.
Description Description
Return Return
(array) List of page IDs.
Source Source
File: wp-includes/post.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;
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
<?php $page_ids=get_all_page_ids(); echo '<h3>My Page List :</h3>'; foreach($page_ids as $page) { echo '<br />'.get_the_title($page); } ?>