[wp-hackers] Best way to verify if a post_id is valid

scribu scribu at gmail.com
Sun Feb 21 13:54:58 UTC 2010


Maybe something like:

if ( $post = get_post($post_id) && 'post' == $post->post_type && 'publish'
== $post->post_status) {
    // do stuff
}

Of course, it depends on what you're doing. So, there's no universal "best
way".


-- 
http://scribu.net


More information about the wp-hackers mailing list