get_page() - WordPress 函数参考中文文档

返回介绍

get_page()

发布于 2017-09-10 字数1766 浏览 889 评论 0

Warning: This function has been deprecated. Use get_post() instead.

get_page( mixed $page,  string $output = OBJECT,  string $filter = 'raw' )

Retrieves page data given a page ID or page object.


描述

Use get_post() instead of get_page().


参数

$page

(mixed)
(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 value: OBJECT

$filter

(string)
(Optional)
How the return value should be filtered. Accepts ‘raw’, ‘edit’, ‘db’, ‘display’.

Default value: ‘raw’


返回值

(WP_Post|array|null) WP_Post (or array) on success, or null on failure.


源代码

File: wp-includes/post.php

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

更新日志

Version 描述
3.5.0 Use get_post()
1.5.1 Introduced.

相关函数

Uses

  • wp-includes/post.php:
    get_post()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!