You can use notify_moderator and notify_post_author filters to control whether or not the comment notification should be sent – to the moderator or comment author.
add_filter('notify_moderator', 'prefix_filter_sent_comment_notification', 10, 2);
add_filter('notify_post_author', 'prefix_filter_sent_comment_notification', 10, 2);
function prefix_filter_sent_comment_notification( bool $maybe_notify, int $comment_ID ) {
$comment = get_comment($comment_ID);
$comment_post = get_post($comment->comment_post_ID);
// determine, if notification should sent or not
// return true to send
// to not, return false
return some_logic_check( $comment_post ) ? false : $maybe_notify;
}
Related Posts:
- Reposition WooCommerce breadcrumb outside of wrapper content
- Display all values of custom a field created with ACF on a page
- How to validate WordPress generated password in DB using PHP?
- wpdb::prepare was called incorrectly
- WordPress the_content() return only one image from a specific category
- count number of user comments with a specific comment meta value
- How can I access the “description” of a menu item?
- Display all posts in current category
- How do I know what variables are passed in a filter/action and what their meaning is?
- How does WP detect format type (and can I make use of this)?
- Remove “Remember Me” from login form
- Wrap each shortcode in array to div
- How can I change WordPress domain from remote to localhost?
- Notify WordPress Site I Have Linked To Them
- Warning: array_pop() expects parameter 1 to be array, boolean given
- Woocommerce filter cart and category specific quantity [closed]
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- Ajax form submit within a Post Metabox
- Problem adding class to body_class
- Shortcode API: How to get name that matched shortcode RegEx?
- SQL QUERY – Select a value directly from the database
- Swapping wp_dropdown_categories function with wp_category_checklist
- Is there a way to programmatically create multiple pages utilizing the same template but different content from a json file?
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Create Page To Count Comments For Each Post In WordPress Site
- Why my image upload button is not working in wordpress widget area?
- How does wp_enqueue_scripts work?
- You do not have sufficient permissions to access this page while making a plugin
- How to let users change site language?
- Problem with login form
- Use of wp_insert_post and parameters
- WordPress theme options error
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- get_the_title() gets printed out twice
- get_users meta_query: REGEXP not working for matching new lines
- Moving code from theme header to functions.php
- Where does “rel=0” get removed from my YouTube parameters?
- Custom array from a query only write the last row of the query
- Woocommerce Email attachments not working – file not being attached
- Best way to use a large array in function
- AJAX button action in foreach
- Ajax button not working
- PHP if statement works in template files, but not header
- Get categories names as an array to use it in theme settings
- CSS change in woo commerce Place Order Text [closed]
- Correctly Using checked function of WordPress
- Known Issues in WordPress When Upgrading PHP to ver 7
- Can’t get url_to_postid to work
- .html end of URl affected to SEO?
- How to get property out of image object
- Cannot modify header information – server cache
- Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin
- Filter unique custom field value based on custom taxonomy category or other custom field
- How can I restrict access to a widget to admins only?
- How to add a custom filter (by coding) before access one wordpress page ? And where to call the custom filter?
- WP_REST_Response – How to return Gzip answer and add Content-encoding header?
- Create Columns with Custom Walker and CSS Classes
- Can’t log in to WordPress wp-admin after adding code to functions.php
- Why would the child theme load in the Customize preview, but not on the site itself?
- Sending simple variable on single page to WP JSON
- Hide a div if the fiels is empty
- How to display acf field values from home page on all pages?
- Illegal string offset checkbox
- current_time function incorrect in plugin and PHP, not in WordPress admin
- Implementing a multilingual WordPress site by installing several instances of WordPress and redirecting
- How can i show specific Category List?
- I got big white screen when i attach main style sheet of Html in functions.php
- Using Javascript On Page – Header and Footer Now Missing
- wp_remote_request to url with port 8001 not woorking
- Change headers for one custom PHP file
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Changable favicon
- Insert div after every three posts in home.php [duplicate]
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- How to remove image on single product and get product to span page?
- Display Content Based on Custom Field Value
- Inline Styling a div from a Custom Metabox
- How can I turn a url with get method as a clean url with segment as the get method?
- insert thumbnail image from php script
- WordPress rating by views [closed]
- 403 (Forbidden) delete file image in themer folder
- Limit the number of successful logins
- How to call a certain object/menubar in a PHP file
- Custom field in title
- Dynamic Gallery
- Blog only showing code
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Get null from POST
- How to have post count after each listed category
- Pagination 404 on my index.php
- Jquery autosave text area after typing
- WP Fatal error: Call to undefined function get_template_directory_uri()
- Remove default Image Sizes
- A better way to write this php function
- Edit Error Page style
- How to sort wordpress posts by selecting a year from a drop down?
- WooCommerce Checkout Cart [closed]
- How can I use AJAX in child theme template?
- WordPress taxonomy and terms question