如何修改WordPress联系表单插件的PHP代码,替换默认接收邮箱?
Hey Mohammed, let's get this sorted out—your problem is actually super straightforward once you spot it in the code!
The Root Cause
Looking at the line you shared:
wp_mail( get_bloginfo('admin_email'), $subject, $fullmsg, $headers );
The first parameter here, get_bloginfo('admin_email'), is explicitly pulling WordPress's default administrator email from your site settings. That's why all submissions are going there instead of your personal email—this line is overriding any other settings you might have tried.
The Fix: Replace the Default Email
All you need to do is swap out that dynamic function call with your actual personal email address as a string. Here's what the modified code should look like:
wp_mail( 'your-personal-email@example.com', $subject, $fullmsg, $headers );
Just replace your-personal-email@example.com with the exact email you want submissions sent to.
Quick Notes to Avoid Headaches
- Double-check the email spelling—even a tiny typo will mean you never get those messages!
- Always back up the original PHP file before making changes. If something goes wrong, you can easily revert.
- After saving the file, submit a test form right away to confirm emails are now landing in your personal inbox.
- If you still have issues, check if another plugin (like an SMTP tool or security plugin) is filtering the
wp_mailfunction, or if your lightweight form plugin has a hidden settings panel that might be overriding this code (though the developer's tip suggests this is the main line to edit).
内容的提问来源于stack exchange,提问作者mohammed afeef

