You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改WordPress联系表单插件的PHP代码,替换默认接收邮箱?

Fixing the WordPress Contact Form Email Recipient Issue

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_mail function, 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:31:07