• I understand filters on a basic level. I can replace the from email option

    However, is it possible to apply a filter in a functions.php or mu plugin when its conditional.

    Ie, I want to allow plugins to give people the option on modifying the from address, and I only wish to replace the from of [email protected] if from == wordpress

    Is that an option?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Not sure if mu mail address filters differ, but something along this line.

    function mcd_mail_from($from) {
      if ('[email protected]' == $from) $from = '[email protected]';
      return $from
    }
    add_filter( 'wp_mail_from', 'mcd_mail_from' );

    Depending on what order the filters are added from various plugins, a different plugin could still change what you have set. Unfortunately, not all plugins are as polite as you and will arbitrarily change things no matter what. Kudos for being considerate of others.

Viewing 1 replies (of 1 total)
  • The topic ‘Possible to add filter based on if statement? (email – wordpress@)’ is closed to new replies.