Moves check on post type inside function.