Skip to content

Conversation

@arnelap
Copy link
Contributor

@arnelap arnelap commented Dec 16, 2025

When submitting a new email I would get an error

  • tags[n] : This value should be of type string.

I decided to go with unsettling the tags from args, and submitting it separately.

Is this the right way though? Tbh I don't really understand how it did work with new subscribers before (and it did).

arnelap and others added 9 commits December 13, 2025 10:19
add_filter('mc4wp_subscriber_data', function (MC4WP_MailChimp_Subscriber $subscriber) {
    $subscriber->tags[] = ['name' => 'removethis', 'status' => 'inactive'];
    return $subscriber;
});
When submitting a new email I would get an error

- tags[n] : This value should be of type string.
@arnelap arnelap marked this pull request as ready for review December 16, 2025 10:15
@arnelap
Copy link
Contributor Author

arnelap commented Dec 16, 2025

ok, so i think what i could do for NEW subscribers is:

  • filter out all the status: inactive form the tags array (no need to remove tags for new subscriber)
  • convert the remaining "active" tags array[name] to a string "tags": ["tag1", "tag2", "tag3"]
  • That can then post to /lists/{list_id}/members without the second api call

That way the procedure stays close to what it has been doing so far.

However, updating subscribers the second API call is required though (and that's already how we did it, right?), I don't think there is any way around it, so maybe doing that same second call for new subscribers is actually the better way to do it to keep results consistent with future changes, and prevent the need to convert the tags to a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants