Fix adds check for post type to prevent php notices.