It fetches values from the custom fields.
Then it makes a call to the Google API using the values from the custom field as searchwords.
The result is saved in a database.
As mentioned before this works when calling wp_head (or shutdown) but not for edit_post or publish_post.