Jump to content

n00b needs simple syntax halp


almsforthestupid

Recommended Posts

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 🙏🙏🙏🙏🙏

Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.