Comment

Comment by simlevesque

Here is a patch I just did:

DISCLAMER: Works only if you set WP_HOME explicitely. if you define it dynamically based on $SERVER['HTTP_HOST'] this won't fix it. (using a switch with $SERVER['HTTP_HOST'] is fine, except if you set a default)

  ------[ wp-includes/pluggable.php before ]------

  ...

  if ( !isset( $from_email ) ) {
          // Get the site domain and get rid of www.
          $sitename = strtolower( $_SERVER['SERVER_NAME'] );
          if ( substr( $sitename, 0, 4 ) == 'www.' ) {
                 $sitename = substr( $sitename, 4 );
          }

          $from_email = 'wordpress@' . $sitename;
  }

  ...
  
  -----------------------------------------
  
  ------[ wp-includes/pluggable.php after ]------
  
  ...
  
  if ( !isset( $from_email ) ) {
          // Get the site domain and get rid of www.
          $sitename = strtolower( WP_HOME );
          if ( substr( $sitename, 0, 7 ) == 'http://' ) {
                  $sitename = substr( $sitename, 7 );
          }
          if ( substr( $sitename, 0, 8 ) == 'https://' ) {
                  $sitename = substr( $sitename, 8 );
          }
          if ( substr( $sitename, 0, 4 ) == 'www.' ) {
                 $sitename = substr( $sitename, 4 );
          }
  
          $from_email = 'wordpress@' . $sitename;
  }
  
  ...
  
  -----------------------------------------
edit: please test this on your setup before deploying it. edit2: fixed with the help of apstls.
parent simlevesque 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton