public function on_term_update($term_id, $tt_id) { // Get an array of fields that we need to update. We don't care about their groups here. $term = get_term_by('term_taxonomy_id', $tt_id); if (!$term instanceof WP_Term) { return; } $factory = Types_Field_Group_Term_Factory::get_instance(); $groups = $factory->get_groups_by_taxonomy($term->taxonomy); if (empty($groups)) { return; } $field_definitions = Types_Field_Utils::get_field_definitions_from_groups($groups); $update_errors = $this->update_term_fields($term_id, $field_definitions); // Display errors if we have any. if (!empty($update_errors)) { foreach ($update_errors as $update_error) { wpcf_admin_message_store($update_error->get_error_message(), 'error'); } wpcf_admin_message_store(sprintf('<strong>%s</strong>', __('There has been a problem while saving custom fields. Please fix it and try again.', 'wpcf')), 'error'); } }