get_post_status [ WordPress Function ]
get_post_status ( $ID = '' )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Similar Functions: get_post_statuses, get_post_stati, _post_states, get_post_status_object, get_blog_status
Retrieve the post status based on the Post ID.
If the post ID is of an attachment, then the parent post status will be given instead.
Source
<?php
function get_post_status($ID = '') {
$post = get_post($ID);
if ( !is_object($post) )
return false;
if ( 'attachment' == $post->post_type ) {
if ( 'private' == $post->post_status )
return 'private';
// Unattached attachments are assumed to be published
if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
return 'publish';
// Inherit status from the parent
if ( $post->post_parent && ( $post->ID != $post->post_parent ) )
return get_post_status($post->post_parent);
}
return $post->post_status;
}
?>
Examples [ wp-snippets.com ]
Top Google Search Results
- Function Reference/get post status « WordPress Codex
Description. Retrieve the post status based on the Post ID. If the post ID is of an attachment, then the parent post status will be given instead.
codex.wordpress.org - get_post_status | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_post_status($ID = '') { $post = get_post($ID); if ( !is_object($post) ) return false; if ( 'attachment' == $post->post_type ) { if ( 'private' ...
hitchhackerguide.com - get_post_status (WordPress Function) - WPSeek.com
WordPress lookup for get_post_status, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - PHPXRef 0.7 : WordPress : Function Reference: get_post_status()
get_post_status(). Defined at: /wp-includes/post.php -> line 566. Referenced 7 times: /wp-includes/query.php -> line 2676 · /wp-comments-post.php -> line 30 ...
phpxref.ftwr.co.uk