• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Jetpack_Subscriptions::should_email_post_to_subscribers() –

You appear to be a bot. Output may be restricted

Description

Usage

Jetpack_Subscriptions::should_email_post_to_subscribers( $post );

Parameters

$post
( mixed ) required –

Returns

void

Source

File name: jetpack/modules/subscriptions.php
Lines:

1 to 54 of 54
  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;
    }

    // Only posts are currently supported
    if ( $post->post_type !== 'post' ) {
      return false;
    }

    // Private posts are not sent to subscribers.
    if ( 'private' === $post->post_status ) {
      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;
  }
 

 View on GitHub View on Trac

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Published: 27 November 2019 | Last updated: 27 November 2019

Primary Sidebar

Information

Function name: Jetpack_Subscriptions::should_email_post_to_subscribers
Class ref: Jetpack_Subscriptions
Plugin ref: Jetpack
Version: 9.2
Sourcefile: modules/subscriptions.php
File ref: modules/subscriptions.php
Deprecated?: No
API Letters: E,J,P,S

Footer

Jetpack a2z
Jetpack a2z
Jetpack a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  jetpack.wp-a2z.org
© Copyright Jetpack a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites