Error thrown

Call to a member function is_custom_post_type() on null