get_all_page_ids()
Get a list of page IDs.
描述
返回值
(array) List of page IDs.
源代码
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;
}
更新日志
Version | 描述 |
---|---|
2.0.0 | Introduced. |
相关函数
Uses
-
wp-includes/cache.php:
wp_cache_get() -
wp-includes/cache.php:
wp_cache_add() -
wp-includes/wp-db.php:
wpdb::get_col()
-
Skip to note content
You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
Contributed by
Codex
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); } ?>
你可能对这些文章感兴趣:
- wordpress函数get_the_posts_navigation()用法示例
- wordpress函数get_the_title()用法示例
- wordpress函数get_the_terms()用法示例
- wordpress函数get_the_tags()用法示例
- wordpress函数get_the_taxonomies()用法示例
- wordpress函数get_the_permalink()用法示例
- wordpress函数get_the_password_form()用法示例
- wordpress函数get_the_posts_pagination()用法示例
- wordpress函数get_the_modified_date()用法示例
- wordpress函数get_the_modified_time()用法示例
- wordpress函数get_the_modified_author()用法示例
- wordpress函数get_the_guid()用法示例
- wordpress函数get_the_ID()用法示例
- wordpress函数get_the_excerpt()用法示例
如有疑问,请前往问答中心反馈!
反馈