File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -294,12 +294,23 @@ private function create_message(){
294
294
* https://core.trac.wordpress.org/ticket/5007.
295
295
*/
296
296
297
- if ( $ this ->api_message ["From " ] == null ) {
297
+ if ($ this ->api_message ["From " ] == null ) {
298
298
$ from_name = 'WordPress ' ;
299
- // Get the site domain and get rid of www.
300
- $ sitename = strtolower ( $ _SERVER ['SERVER_NAME ' ] );
301
- if ( substr ( $ sitename , 0 , 4 ) == 'www. ' ) {
302
- $ sitename = substr ( $ sitename , 4 );
299
+ $ sitename = 'localhost ' ;
300
+
301
+ // Check if SERVER_NAME is set
302
+ if (isset ($ _SERVER ['SERVER_NAME ' ])) {
303
+
304
+ // Set sitename to SERVER_NAME
305
+ $ sitename = $ _SERVER ['SERVER_NAME ' ];
306
+
307
+ // Make it lowercase
308
+ $ sitename = strtolower ($ sitename );
309
+
310
+ // Get rid of www. if it exists
311
+ if (substr ($ sitename , 0 , 4 ) == 'www. ' ) {
312
+ $ sitename = substr ($ sitename , 4 );
313
+ }
303
314
}
304
315
305
316
$ from_email = 'wordpress@ ' . $ sitename ;
You can’t perform that action at this time.
0 commit comments