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

get_page() WordPress Function

The get_page() function is used to retrieve a page object from the WordPress database. This function takes a page ID or page slug as its only parameter. If successful, the function will return a page object.

get_page( int|WP_Post $page, string $output = OBJECT, string $filter = 'raw' ) #

Retrieves page data given a page ID or page object.


Description

Use get_post() instead of get_page().


Top ↑

Parameters

$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 value: OBJECT

$filter

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

Default value: 'raw'


Top ↑

Return

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


Top ↑

Source

File: wp-includes/post.php

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


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Use get_post()
1.5.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More