humanmade / hm-base

Standard project layout for Human Made Projects.
81 stars 18 forks source link

WP_CONTENT_URL is empty on the CLI #49

Open johnbillion opened 8 years ago

johnbillion commented 8 years ago

Given the following CLI command:

wp eval 'echo WP_CONTENT_URL;'

The output will be http:///content. This resulted in a bunch of malformed URLs during the migration of a client project where attachment URLs were being generated and inserted into post content.

johnbillion commented 8 years ago

The source of the problem is the fact that WP_CONTENT_URL is constructed from the value of WP_HOME, which is in turn constructed from the value of $_SERVER['HTTP_HOST'], which has an empty value on the CLI: https://github.com/humanmade/hm-base/blob/9ee2a5014c8b525cf42f8d268091c47e7adb3d85/wp-config.php#L18-L21