WP Email Manager provides the following filters:
1. wp_email_manager_domains
This filter can be used to filter the domains that can be used by the plugin. It is useful where your email server has lots of domains and you want to use only a handful of them with WP Email Manager.
$mapped_domains = apply_filters( 'wp_email_manager_domains', $mapped_domains, $blog_id, $user_id );
Example usage
/**
* Filter the domains that WP Email Manager can use
*
* Ensure that the domain(s) listed below are added to the server.
*
* @param $domains array
* @param $blog_id int
* @param $user_id int
*
* @return array
*/
add_filter('wp_email_manager_domains', 'my_filter_domains_function', 20, 3);
function my_filter_domains_function( $domains, $blog_id, $user_id ){
$domains = array('domain.com', 'domain.net', 'domain.org');
return $domains;
}
2. wp_email_manager_enable_plugin_settings_page
This filter is used to hide the plugin’s settings page.
$enable_plugin_settings_page = apply_filters('wp_email_manager_enable_plugin_settings_page', true);
Example usage
/**
* Hide WP Email Manager's plugin admin settings page
*
* @param $enable_plugin_settings_page bool
*
* @return bool
*/
add_filter('wp_email_manager_domains', 'my_hide_settings_page_function', 20, 1 );
function my_hide_settings_function( $enable_plugin_settings_page ){
$enable_plugin_settings_page = false;
return $enable_plugin_settings_page;
}
Troubleshooting
- If the filters don’t work, try adding them to a must use plugin which is placed in the mu-plugins folder.