Hacker News new | ask | show | jobs
by kels 3337 days ago
You could do this a lot easier:

  if ( !isset( $from_email ) ) {
    $sitename = parse_url( strtolower( WP_HOME ) )['host'];

    if ( substr( $sitename, 0, 4 ) == 'www.' ) {
      $sitename = substr( $sitename, 4 );
    }

    $from_email = 'wordpress@' . $sitename;
  }
Edit: you still need to strip out www. if it exits. Also not compatible with < PHP 5.4
1 comments

They might have avoided this code for compatibility.