check if post id is exists in post type code example Example: check if post id exists wordpress post_exists(get_the_title($postID)); //returns $postID or 0