Allow disable specific emails through a filter
-
Like many others we also found a bug with this plugin overriding templates from other plugins. In our case it’s Tribe Events (ticket email). Currently it doesn’t send ticket emails anymore when this plugin is active.
Please create a filter to disable this plugin for specific emails. That way users can easily define their own conditions for disabling it.
Cheers, Jory
-
Hi @keraweb,
Thank you for reaching out and reporting this issue.
We’re sorry to hear that the plugin is conflicting with the Tribe Events ticket emails. We have shared the details with our development team so they can replicate the issue and investigate the root cause further.
Your suggestion regarding adding a filter to disable the plugin for specific emails also makes sense, and we’ve forwarded this feedback to the team for consideration.
We’ll keep you updated as soon as we receive any news from the developers.
In the meantime, if you experience any other issues or need assistance, please let us know.
Thanks & regards,
WPExperts Support TeamHi @keraweb,
Thank you for your patience.
We tested the email template with the Event Tickets and Registration plugin, and the emails are working correctly on our end. However, if you could share a screencast or specify which email is not being delivered, it would help us identify the root cause of the issue.
You can also open a support ticket directly through our portal. This will allow us to connect you directly with our developer and resolve the issue as quickly as possible.
For other readers: we will post the resolution here once the client’s issue has been resolved.
Thank you.
This specific case is about the “Ticket Email” configured in Tickets > Settings > Emails.
It might also be worth mentioning that we have the pro version working with WooCommerce. So the ticket orders are handled in WooCommerce and only the ticket email itself is done by Events Tickets (including a PDF ticket). Because of this, tickets are send instantly and not through a scheduled action.I have confirmed that the issue is coming from within your plugin since it works fine when I disable it and stops working again when I enable it.
I also saw that you have a hardcoded check for Elementor so I tried to replicate this myself for TEC by disabling the mail content handler (Mailtpl_Mailer::send_mail) but that didn’t help unfortunately. Besides the “send_mail” handler there is something else that prevents the mail from being sent, most likely another filter.In any case, if it would be possible to fully disable mail handling by your plugin through a filters then that would already solve our issue.
Cheers, Jory
Hi @keraweb,
Thank you for the detailed explanation and additional testing.
We’ve shared your findings with our development team, and they are currently working on investigating the conflict with the “Ticket Email” from The Events Calendar / Event Tickets setup, especially in the WooCommerce + PDF ticket scenario you described.
Your suggestion about adding a filter to completely disable our plugin’s mail handling for specific emails is also under active consideration, as we understand this would provide a flexible workaround for custom integrations like yours.
We appreciate the technical details you provided regarding the
Mailtpl_Mailer::send_mailhandler and the additional filters involved. This information is very helpful for narrowing down the root cause.We’ll update this thread as soon as we have progress from the developers or a patch available.
Thank you again for your patience and cooperation.
Thanks & regards,
WPExperts Support TeamHi @keraweb,
Thank you for your patience and cooperation while we investigated this issue.
Our development team has implemented a solution that should resolve the conflict with the TEC / Event Tickets “Ticket Email” setup.
We’ve added a new filter:
mailtpl_disable_for_emailThis filter allows developers to fully bypass the Email Templates plugin for specific emails when needed, which should help prevent conflicts with custom email handlers such as Event Tickets / TEC.
We are attaching an updated version of the plugin for testing. Please install it on your staging/site and let us know if the ticket emails are working correctly with this version. Once we receive your confirmation, we will proceed with releasing the fix publicly.
You can download the updated build from this link: https://drive.google.com/file/d/1MAeEVY29iWjt27Tw4JePFsz-4K9GzfQd/view?usp=sharing
Looking forward to your feedback.
Thanks & regards,
WPExperts Support TeamThank you for the patched version, I can see the filter in send_mail, but it’s not working for this instance. As I mentioned, we have WooCommerce active and this mail, even though triggered by Tribe, still seems to go through the WooCommerce email process.
The filter you’ve added only disabled the send_mail() handler, not all the WooCommerce additions added inclass-mailtpl-woomail-composer.php. Once I disableon_plugins_loaded_woomail()function hooked onplugins_loadedit starts to work again.Even if I completely disable disable
define_hooksin class-mailtpl.php the Tribe email is still not send. Only if I disable the above mentioned Woo related handler it starts to work again.It looks like your WooCommerce integration bypasses the newly added filter to disable emails and still tries to modify the template output or even the email itself.
Cheers, Jory
Hi @keraweb,
Thank you for your detailed feedback and additional testing.
Our development team has now implemented an additional fix for the WooCommerce-level handling that was still affecting the TEC/Event Tickets emails.
We’ve added two filters that now work together:
mailtpl_disable_for_email
Disables the core email template wrapper.mailtpl_disable_woo_for_email
Disables the WooCommerce-level template overrides (header, footer, template files, etc.).
This should allow specific emails — including TEC ticket emails — to fully bypass our plugin’s processing when needed.
Please add the following code to your theme’s
functions.phpfile:<?php
// Filter 1: Disable core email wrapper for TEC ticket emails
add_filter( 'mailtpl_disable_for_email', function( $disabled, $args ) {
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 20 );
foreach ( $backtrace as $trace ) {
if ( isset( $trace['file'] ) && strpos( $trace['file'], 'event-tickets' ) !== false ) {
return true;
}
}
return $disabled;
}, 10, 2 );
// Filter 2: Disable WooCommerce template overrides for TEC ticket emails
add_filter( 'mailtpl_disable_woo_for_email', function( $disabled, $email ) {
if ( $email && strpos( get_class( $email ), 'Tribe' ) !== false ) {
return true;
}
return $disabled;
}, 10, 2 );We’ve also attached an updated build for testing:
Build download link: https://drive.google.com/file/d/1B4O064J3XbsA6yxbdtxlCCMIH4EnT0lp/view?usp=sharing
Please test this version on your staging/site and let us know whether the TEC ticket emails are now being delivered correctly.
Looking forward to your feedback.
Thank you
Thank you for the quick update. I think we’re close but it’s not working yet.
I did some digging into both plugins.The issue here is not solvable with the new
mailtpl_disable_woo_for_emailfilter. The important nuance here is that this Tribe email is actually triggered by the default Woo email and somehow, the changes made by your plugin prevents this from happening.Now, when I manually instantiate the Tribe email class on your
mailtpl_disable_woo_for_emailfilter it starts working so there seems to be a loading order issue. It looks like you load the WooCommerce email templates (WC_Emails) earlier than Tribe registers it’s email template and therefore their action flow is never fully handled properly.Example code:
add_filter( 'mailtpl_disable_woo_for_email', function( $disabled, $email ) {
$emails = WC()->mailer()->get_emails();
if ( ! isset( $emails['Tribe__Tickets__Woo__Email'] ) ) {
// Register hooks.
new Tribe__Tickets_Plus__Commerce__WooCommerce__Email();
}
return $disabled;
} );While this works as a temporary patch it would be awesome if this could be made compatible permanently instead of requiring somewhat of a hack like this.
Cheers, Jory
Hi @keraweb,
Thank you for the detailed investigation and for sharing your findings along with the temporary workaround.
Your explanation regarding the WooCommerce email initialization order and the Tribe email class registration was very helpful. We have shared these details with our development team, and they are currently reviewing the loading sequence and compatibility handling to implement a proper long-term fix instead of relying on manual class instantiation.
We appreciate the time you invested in debugging this issue and helping us narrow down the root cause.
We’ll get back to you as soon as we have an update or a new patched version available for testing.
Thank you again for your patience and cooperation.
Thank you
Hi Jory,
Thanks for the detailed investigation — it helped us pinpoint the exact issue.
Root Cause: In class-mailtpl-woomail-composer.php, the
on_init()method was callingWC()->mailer()early (hooked onafter_setup_themeat priority 80) to remove WooCommerce’s default email header. This forced WooCommerce to instantiate its mailer and lock in all registered email classes before Tribe had a chance to register its ticket email — effectively excluding it from the WooCommerce email flow permanently.Fix (line ~107, class-mailtpl-woomail-composer.php): We’ve moved that
remove_actioncall to fire lazily at send time (priority 0 onwoocommerce_email_header), so it only runs when an email is actually being sent — by which point all plugins including Tribe have fully registered their email classes. This means your custom workaround snippet is no longer needed and can be removed from functions.php.You can download the updated plugin from this URL: https://drive.google.com/file/d/1dwXMMY4tkPac5QuTnXAte-TsrAjASekl/view?usp=sharing
Please test and let us know.
Thank you
You must be logged in to reply to this topic.