No sense in trying to add terms to a post if the post doesn't support the taxonomy
Properly sanitize and escape gallery shortcode
Use a high upper bound when fetching posts so all metadata is pre-fetched