DP Mail From Override and Contact Form Recipient Fix

/**
* 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);

LEAVE A COMMENT

Your comment will be published within 24 hours.

ONLINE APPOINTMENT

Book your appointment now and get $5 discount.

MAKE APPOINTMENT
LATEST POSTS
MOST VIEWED
TEXT WIDGET

Here is a text widget settings ipsum lore tora dolor sit amet velum. Maecenas est velum, gravida vehicula dolor

CATEGORIES

ARCHIVES

© Copyright 2026 Car Service Theme by Detail Plusiowa