get_post_field [ WordPress Function ]
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Retrieve data from a post field based on Post ID.
Examples of the post field will be, 'post_type', 'post_status', 'post_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.
Source
<?php
function get_post_field( $field, $post, $context = 'display' ) {
$post = (int) $post;
$post = get_post( $post );
if ( is_wp_error($post) )
return $post;
if ( !is_object($post) )
return '';
if ( !isset($post->$field) )
return '';
return sanitize_post_field($field, $post->$field, $post->ID, $context);
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/get post field « WordPress Codex
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 ...
codex.wordpress.org - get_post_field | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_post_field( $field, $post, $context = 'display' ) {}. Retrieve data from a post field based on Post ID. Examples of the post field will be, ...
hitchhackerguide.com - PHPXRef 0.7 : WordPress : Function Reference: get_post_field()
Function and Method Cross Reference. get_post_field(). Defined at: /wp-includes /post.php -> line 448. Referenced 7 times: /wp-includes/link-template.php ...
phpxref.ftwr.co.uk - Get wordpress post content by post id - WordPress
Feb 17, 2011 ... Shorthand for specific field: $content = get_post_field('post_content', $my_postid) ; – Rarst♦ Feb 17 '11 at 21:39. @t31os I believe it's quoting ...
wordpress.stackexchange.com