public function should_email_post_to_subscribers($post) { $should_email = true; if (get_post_meta($post->ID, '_jetpack_dont_email_post_to_subs', true)) { return false; } /** * Array of categories that will never trigger subscription emails. * * Will not send subscription emails from any post from within these categories. * * @module subscriptions * * @since 3.7.0 * * @param array $args Array of category slugs or ID's. */ $excluded_categories = apply_filters('jetpack_subscriptions_exclude_these_categories', array()); // Never email posts from these categories if (!empty($excluded_categories) && in_category($excluded_categories, $post->ID)) { $should_email = false; } /** * ONLY send subscription emails for these categories * * Will ONLY send subscription emails to these categories. * * @module subscriptions * * @since 3.7.0 * * @param array $args Array of category slugs or ID's. */ $only_these_categories = apply_filters('jetpack_subscriptions_exclude_all_categories_except', array()); // Only emails posts from these categories if (!empty($only_these_categories) && !in_category($only_these_categories, $post->ID)) { $should_email = false; } return $should_email; }