函数原型
get_page( int|WP_Post $page, string $output = OBJECT, string $filter = ‘raw’ ): WP_Post|array|null
函数描述
Retrieves page data given a page ID or page object.
是否弃用
Warning: This function has been deprecated. Use get_post() instead.
函数参数
-
$page
int|WP_Post
Required - Page object or page ID. Passed by reference.
-
$output
string
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 -
$filter
string
Optional - How the return value should be filtered. Accepts
'raw','edit','db','display'. Default'raw'.Default:
'raw'
函数返回值
WP_Post|array|null WP_Post or array on success, null on failure.
函数位置
File: wp-includes/post.php.
函数源码
function get_page( $page, $output = OBJECT, $filter = 'raw' ) {
return get_post( $page, $output, $filter );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.5.0 | Use get_post() |
| 1.5.1 | Introduced. |

