get_page( int|WP_Post $page, string $output = OBJECT, string $filter = ‘raw’ ): WP_Post|array|null

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

Retrieves page data given a page ID or page object.

Description

Use get_post() instead of get_page() .

Parameters

$pageint|WP_Postrequired
Page object or page ID. Passed by reference.
$outputstringoptional
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

$filterstringoptional
How the return value should be filtered. Accepts 'raw', 'edit', 'db', 'display'. Default 'raw'.

Default:'raw'

Return

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

Source

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

Changelog

VersionDescription
3.5.0Use get_post()
1.5.1Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Add the content of a page anywhere with separated title.

    $id = 0; // add the ID of the page where the zero is
    $p = get_page($id);
    $t = $p->post_title;
    echo '<h3>'.apply_filters('post_title', $t).'</h3>'; // the title is here wrapped with h3
    echo apply_filters('the_content', $p->post_content);

You must log in before being able to contribute a note or feedback.