get_page

函数


get_page ( $page, $output = OBJECT, $filter = 'raw' )
参数
  • (int|WP_Post)
    $page
    Page object or page ID. Passed by reference.
    Required:
  • (string)
    $output
    Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    Required:
    Default: OBJECT
  • (string)
    $filter
    Optional. How the return value should be filtered. Accepts ‘raw’, ‘edit’, ‘db’, ‘display’. Default ‘raw’.
    Required:
    Default: ‘raw’
返回值
  • (WP_Post|array|null) WP_Post or array on success, null on failure.
定义位置
  • wp-includes/post.php
    , line 5656
引入
1.5.1
弃用
3.5.0

检索页面数据,给定一个页面ID或页面对象。

使用get_post()而不是get_page()。

function get_page( $page, $output = OBJECT, $filter = 'raw' ) {
	return get_post( $page, $output, $filter );
}