After changing the email address and sender name, add the following code in the functions.php file of your active theme.
<code class="php comments">// Function to change email address</code> <div class="container"> <div class="line number3 index2 alt2"><code class="php keyword">function</code><code class="php plain">wpdev_sender_email( </code><code class="php variable">$original_email_address</code><code class="php plain">) {</code></div> <div class="line number4 index3 alt1"><code class="php spaces"> </code><code class="php keyword">return</code><code class="php string">'bdhostit@example.com'</code><code class="php plain">;</code></div> <div class="line number5 index4 alt2"><code class="php plain">}</code></div> <div class="line number6 index5 alt1"></div> <div class="line number7 index6 alt2"><code class="php comments">// Function to change sender name</code></div> <div class="line number8 index7 alt1"><code class="php keyword">function</code><code class="php plain">wpdev_sender_name( </code><code class="php variable">$original_email_from</code><code class="php plain">) {</code></div> <div class="line number9 index8 alt2"><code class="php spaces"> </code><code class="php keyword">return</code><code class="php string">'BD HOST IT'</code><code class="php plain">;</code></div> <div class="line number10 index9 alt1"><code class="php plain">}</code></div> <div class="line number11 index10 alt2"></div> <div class="line number12 index11 alt1"><code class="php comments">// Hooking up our functions to WordPress filters </code></div> <div class="line number13 index12 alt2"><code class="php plain">add_filter( </code><code class="php string">'wp_mail_from'</code><code class="php plain">, </code><code class="php string">'wpdev_sender_email'</code><code class="php plain">);</code></div> <div class="line number14 index13 alt1"><code class="php plain">add_filter( </code><code class="php string">'wp_mail_from_name'</code><code class="php plain">, </code><code class="php string">'wpdev_sender_name'</code><code class="php plain">);</code></div> </div> <div>
Leave a Reply