Check for post_title instead of post_name in ot_get_media_post_ID() as post slug is not guaranteed.