• Resolved Martin

    (@vogtm)


    Hi There

    I’m using Jetpack also the “send email to subscibers” feature. Now i wanted to restrict emails only sent out when a specific category is chosen. Let’s call the category “email”. I’ve added those lines of code into my child theme’s function.php:

    add_filter( 'jetpack_subscriptions_exclude_all_categories_except', 'exclude_all_except' );
    function exclude_all_except( $categories ) {
    	$categories = array( 'email', 'category-slug-2');
    	return $categories;
    }

    For whatever reason, it still always sending out emails regardless if i set a category or not.

    Any thoughts?

    thanks

    martin

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor James Huff

    (@macmanx)

    Volunteer Moderator

    It looks like you have an extra bit from our example array. Try just this:

    add_filter( 'jetpack_subscriptions_exclude_all_categories_except', 'exclude_all_except' );
    function exclude_all_except( $categories ) {
    	$categories = array( 'email' );
    	return $categories;
    }
    Thread Starter Martin

    (@vogtm)

    @macmanx Many thanks, but I did already, it doesn’t helped. Now JetPack doesn’t send emails anymore regardless if i put a post in category ’email’ in or not.

    This means, the code is doing something, but it does not evaluate the category. I have used the same value in the filter as it’s in the slug field of the category, is this correct? I also checked that upper/lower case is right..

    So current code is:

    add_filter( 'jetpack_subscriptions_exclude_all_categories_except', 'exclude_all_except' );
    function exclude_all_except( $categories ) {
            $categories = array( 'email' );
            return $categories;
    
    Plugin Support KokkieH

    (@kokkieh)

    I have used the same value in the filter as it’s in the slug field of the category, is this correct?

    That’s what you should be using, yes.

    So current code is:

    You might just not have pasted it here, but the code in your last comment above is missing the closing }. Please double check that that’s in your file.

    And just making sure, you’re only using this filter, right? You’re not using the other exclude filter at https://jetpack.com/support/subscriptions/#filters as well?

    Would you be willing to share a link to your site so we can check if there isn’t another issue that might be interfering?

    If you don’t want to share it publicly, you can also submit a support ticket at https://jetpack.com/contact-support/?rel=support instead, and someone can help you via email. If you do that, please mention this thread.

    Thread Starter Martin

    (@vogtm)

    Thanks for your support. Yes, there is the only filter I’m using. I did already submit a support request to the Jetpack, the answer see below:

    The site I’m testing is http://wp.avbs.selfip.net/. I can grant you admin rights, just let me know your email.

    Code again:

    add_filter( 'jetpack_subscriptions_exclude_all_categories_except', 'exclude_all_except' );
    function exclude_all_except( $categories ) {
            $categories = array( 'email' );
            return $categories;
    }
    

    *** JetPack support Request 2061366 ***
    Hey Martin!
    As MadHatter mentioned, we only support the base functionality of the Jetpack plugin. Going in to snippets / filters / hooks are outside of our scope of support.
    We do offer some examples of potential filters to get you started here, but they’re offered purely as a starting point:
    https://jetpack.com/support/subscriptions/#filters
    Let us know if you have any questions about the base functionality of Jetpack, we’ll be happy to help.
    Thanks,
    Anthony Faxlandez
    Happiness Engineer | Automattic

    Plugin Contributor James Huff

    (@macmanx)

    Volunteer Moderator

    They are correct, our ability to support custom code is limited.

    Is this is not working for you as desired, we recommend hiring someone to build you the custom solution you need: https://jetpack.pro/

    Thread Starter Martin

    (@vogtm)

    I think, i will just use another solution than jetpack. I thought this is a simple task having a bit more control of the emails sent out, but obviously nobody can help. It’s a bit frustrating to be honest. I can’t imagine, that I’m the only one who has this problem. First i have tried to add the checkbox, that you can choose per post if an email should send out, but there is a (confirmed) bug.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘JetPack email to subscibers based on category?’ is closed to new replies.