jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Newsletter: allow defaulting to "post only" for the site

Open simison opened this issue 1 year ago • 4 comments

Screenshot 2024-06-11 at 19 13 15 Screenshot 2024-06-11 at 19 15 20

Could be a PHP filter for starters, or a setting somewhere next up.

simison avatar Jun 12 '24 16:06 simison

This snippet of code sets the default to "do not send":

function register_meta_args_filter_jetpack_dont_send_post_by_default( $args, $defaults, $object_type, $meta_key ) {
	if ( $meta_key !== '_jetpack_dont_email_post_to_subs' ) {
		return $args;
	}

	$args['default'] = 1;

	return $args;
}
add_filter( 'register_meta_args', 'register_meta_args_filter_jetpack_dont_send_post_by_default', 10, 4 );

Now when you hit publish on new posts:

Screenshot 2024-06-21 at 15 44 45

If we would want to add more straightforward filter, we'd add it here:

https://github.com/Automattic/jetpack/blob/f8ce5bc19593297b09dfb1ffaed4251ca9df4927/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php#L96-L100

simison avatar Jun 21 '24 12:06 simison

A user requested this here: 8749653-zen

ariel-maidana avatar Sep 19 '24 16:09 ariel-maidana

Support References

This comment is automatically generated. Please do not edit it.

  • [ ] 8749653-zen

github-actions[bot] avatar Sep 19 '24 16:09 github-actions[bot]

I just sent seven emails today, completely forgetting about this functionality. I was adding posts to my backlog. They weren't meant to be highlighted. I only realized I had sent those newsletters when I saw my subscriber count drop. The button just blends into the interface. It's my fault, yes, but it needs some guardrails for folks like me! First, thank you @simison for the filter code. I've added it to my theme.

I would love to see an option to choose my default. Or, at least provide a confirm dialog warning when posting to email.

Thank you!

VegetarianZombie avatar Jun 10 '25 18:06 VegetarianZombie