Codex

Function Reference/get page

Contents

Description

Retrieves page data given a page ID or page object.

Pages provide a way to have static content that will not affect things like articles or archives or any other blog entry features of WordPress. Its simply a way to turn a blog entry into static content.

Usage

<?php get_page$page_id ?>

Parameters

$page_id
(integer) (optional) Page ID passed by reference (see example below)
Default: Page ID from global variable at time function is called
$output
(OBJECT/ARRAY_A/ARRAY_N) (optional) What to output.
Default: OBJECT
$filter
(string) (optional) How the return value should be filtered. Options are 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The 'attribute' and 'js' contexts are treated like 'display'.
Default: 'raw'

Return Values

(object|array) 
mixed Page data.
   [ID]                    => (integer)
   [post_author]           => (integer)
   [post_date]             => (YYYY-MM-DD HH:MM:SS)
   [post_date_gmt]         => (YYYY-MM-DD HH:MM:SS)
   [post_content]          => (all post content is in here)
   [post_title]            => (Post Title Here)
   [post_excerpt]          => (Post Excerpt)
   [post_status]           => (? | publish)
   [comment_status]        => (? | closed)
   [ping_status]           => (? | closed)
   [post_password]         => (blank if not specified)
   [post_name]             => (slug-is-here)
   [to_ping]               => (?)
   [pinged]                => (?)
   [post_modified]         => (YYYY-MM-DD HH:MM:SS)
   [post_modified_gmt]     => (YYYY-MM-DD HH:MM:SS)
   [post_content_filtered] => (?)
   [post_parent]           => (integer)
   [guid]                  => (http://mydomain/?page_id={[ID]})
   [menu_order]            => (integer)
   [post_type]             => (? | page)
   [post_mime_type]        => ()?)
   [comment_count]         => (integer)
   [ancestors]             => (object|array)
   [filter]                => (? | raw)
This page is marked as incomplete. You can help Codex by expanding it.

Examples

<?php 
$page_id 
get_the_ID();
$page_data get_page$page_id );

$title $page_data->post_title// Get title
$content $page_data->post_content// Get Content
?>

Notes

Change Log

Since: 1.5.1

Source File

get_page() is located in wp-includes/post.php.

Related

get_post