Triggers when a new membership is added, including both upgrades and downgrades. Note that this action hook runs when a membership record is created, but not necessarily when the membership is activated. So if a membership is created with the status "pending", then this hook will trigger. Therefore, this action should not be used under the assumption that the membership is active. If you only want to trigger custom code on activation, you may want to use one of these instead:
- $membership_id (int) - ID of the new membership record.
- $data (array) - Arguments used to create the membership record.