WordPress开发者和主题制作者的搜索引擎



get_all_page_ids ›

Since2.0.0
已弃用n/a
get_all_page_ids ( 没有参数 )
返回:
  • (array) List of page IDs.
定义在:
文档:

Get a list of page IDs.



源码

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;
}