almsforthestupid Posted October 12, 2021 Share Posted October 12, 2021 Hey there, I've never PHPd before and want to see if I'm doing this right. My Wordpress site is giving the Wordpress "from" name on emails when users are notified of a password change, and I wanna change it to the company name. On another forum this was the up-dooted solution for the problem -------- add_filter( ‘wp_mail_from_name’, ‘new_mail_from_name’ ); function new_mail_from_name( $old ) { return get_option( ‘blogname’ ); } --------- And I wanna see if the below looks right to you as what I'd put in the functions file --------- add_filter( ‘WordPress’, ‘alphaequipment’ ); function new_mail_from_name( $old ) { return get_option( ‘alphaequipment.com’ ); } ----------- I realize I can break the site, and I understand you give no guarantee that this will work. I also know it's an eye-roll ask. I promise I will study up on this when I can but I'm already super late 😫 Thank you so much 🙏🙏🙏🙏🙏 Quote Link to comment https://forums.phpfreaks.com/topic/313965-n00b-needs-simple-syntax-halp/ Share on other sites More sharing options...
requinix Posted October 12, 2021 Share Posted October 12, 2021 1. The second argument to add_filter() is the name of a function WP should call when it wants to use whatever filter. The name of your function is "new_mail_from_name" and not "alphaequipment". 2. get_option() will want the name of the option it should get. An option name would be like "blogname". You very likely do not have an option named "alphaequipment.com". Have you tried using that add_filter + function code without making any changes to it? 1 Quote Link to comment https://forums.phpfreaks.com/topic/313965-n00b-needs-simple-syntax-halp/#findComment-1590955 Share on other sites More sharing options...
almsforthestupid Posted October 12, 2021 Author Share Posted October 12, 2021 Thank you so much. I did try it, didn't do anything, but yeah now I see how dumb it was to try to give those queries specific values lol Quote Link to comment https://forums.phpfreaks.com/topic/313965-n00b-needs-simple-syntax-halp/#findComment-1590961 Share on other sites More sharing options...
requinix Posted October 12, 2021 Share Posted October 12, 2021 The code (when unchanged) seems fine, but I'm no WordPress expert. You are using that, right? I didn't notice you changed "wp_mail_from_name" to be "WordPress" - that should not be there either. The "blogname" option should also be correct. In the WP options, there should be a title set. That would be provided for whatever "wp_mail_from_name" controls. Quote Link to comment https://forums.phpfreaks.com/topic/313965-n00b-needs-simple-syntax-halp/#findComment-1590967 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.