- September 27, 2026
- By odai elmasri
- In Uncategorized
- 2
- 0
/**
* Detail Plus Iowa — Mail From & Contact Form recipient override.
*
* 1. Forces all wp_mail() calls to use admin@detailplusiowa.com as the From
* address and “Detail Plus Iowa” as the From name. This is safe on both
* staging and production because the address is tied to the real mailbox.
*
* 2. Overrides the Carservice theme contact-form recipient so it always
* delivers to admin@detailplusiowa.com regardless of the WordPress
* admin_email setting.
*/
/* — 1. Force From address for all wp_mail() — */
add_filter(‘wp_mail_from’, function($from){
return ‘admin@detailplusiowa.com’;
});
add_filter(‘wp_mail_from_name’, function($name){
return ‘Detail Plus Iowa’;
});
/* — 2. Override Carservice contact-form recipient — */
add_filter(‘cs_contact_form_recipient’, function(){
return ‘admin@detailplusiowa.com’;
});
/**
* Fallback: if the theme doesn’t expose that filter, hook into phpmailer_init
* to guarantee the To address is always the business mailbox when the native
* theme form is the one sending. The theme’s action hook is
* ‘cs_contact_form_before_send’ — we hook before send and force the address.
*/
add_action(‘cs_contact_form_before_send’, function(&$args){
if(isset($args[‘to’])){
$args[‘to’] = ‘admin@detailplusiowa.com’;
}
}, 10, 1);