Codex

Function Reference/get post field

Contents

Description

Retrieve data from a post field based on Post ID.

Examples of the post field will be, 'post_type', 'post_status', 'content', etc and based off of the post object property or key names.

The context values are based off of the taxonomy filter functions and supported values are found within those functions.

Usage

<?php get_post_field$field$post$context ); ?>

Parameters

$field
(string) (required) Post field name
Default: None
$post
(id) (required) Post ID
Default: None
$context
(string) (optional) Optional. How to filter the field. Default is display.
Default: display

Return Values

(WP_Error|string) 
Value in post field or WP_Error on failure

Change Log

Since: 2.3

Source File

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