DK_
DK_

Reputation: 147

WordPress "Notice: Undefined index: host" after initial setup running locally on linux

I'm trying to set up WordPress on my laptop running Kali Linux. Everything works until I install WordPress and the theme I am using. I'm trying to use roots sage on bedrock. But after I get through the installation process I get a notice in the admin:

Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2937
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2937
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999

And in the frontend:

Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999

Can anyone explain why I'm getting these notices? I must have missed something but I've gone through the instructions several times and I'm out of ideas. Thanks

Upvotes: 6

Views: 11478

Answers (3)

chrisi1698
chrisi1698

Reputation: 21

I just now came across this and for me, switching back from PHP 8.x.x to PHP 7.x.x resolved the issue.

Upvotes: 0

Theo Chirica
Theo Chirica

Reputation: 4516

This can also be caused by an error with the siteurl and home options in wp_options table.

Make sure the url's have a host as well, http://example.com not just example.com.

Upvotes: 8

Prashant Suthar
Prashant Suthar

Reputation: 387

You can define WP_HOME & WP_SITEURL in wp-config.php

define('WP_HOME','http://localhost/project_folder_name');
define('WP_SITEURL','http://localhost/project_folder_name');

Upvotes: 10

Related Questions