In WordPress possiamo verificare se un determinato post esiste o meno.
Possiamo scrivere:
function my_post_exists( $id ) {
if( !is_int( $id ) ) {
return false;
}
$the_post = get_post( $id );
return ( !is_null( $the_post ) );
}