Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically disable any plugin declaring wp_mail first #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BrianHenryIE
Copy link

I see there is a notice on the plugins page, but I imagine most people just want to install and go.

In your conditional if (!function_exists('wp_mail')) { I've added else which uses reflection to find the file wp_mail has been declared in, then find what plugin that is in, then disable the plugin.

To test, you can add this as a plugin:

<?php
/**
 * Plugin Name:       A WP_Mail Dummy
 * Description:       A plugin whose name starts with "A" which sets a custom wp_mail function.
 * Text Domain:       a-wpmail-dummy
 */
if (!function_exists('wp_mail')) {
	function wp_mail( $to, $subject, $message, $headers = '', $attachments = [] ) {
		return true;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant