wp post list | count
from the command line, you will see this response before the actual count:
PHP Warning: Undefined array key "HTTP_HOST" in ./wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php on line 2053
Warning: Undefined array key "HTTP_HOST" in ./wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php on line 2053
PHP Warning: Undefined array key "HTTP_HOST" in ./wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php on line 2061
Warning: Undefined array key "HTTP_HOST" in ./wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php on line 2061
This is because the plugin assumes that $_SERVER
includes an item with the key HTTP_HOST
, which is not true when WordPress is running from the command line (and also not true in a number of other cases).
At a minimum, this command should check with array_key_exists()
before trying to use the HTTP_HOST
key.
Better yet, the plugin should probably use the WordPress get_site_url()
call to determine the host information instead of the $_SERVER
information.
Best, the plugin should notice that it is being run from the CLI (check if ( defined( 'WP_CLI' ) && WP_CLI ) {...}
) before it takes certain actions that just are not needed when running from the command line.
to 4.5.6 and i am getting below warnings and error in commandline.
Error and Warning output:
PHP Warning: ?Undefined array key "HTTP_REFERER" in /www/<SITENAME>/public/wp-content/plugins/woo-razorpay/includes/plugin-instrumentation.php on line 125
Warning: Undefined array key "HTTP_REFERER" in /www/<SITENAME>/public/wp-content/plugins/woo-razorpay/includes/plugin-instrumentation.php on line 125
PHP Warning: ?Undefined array key "HTTP_HOST" in /www/<SITENAME>/public/wp-content/plugins/woo-razorpay/includes/plugin-instrumentation.php on line 265
Warning: Undefined array key "HTTP_HOST" in /www/<SITENAME>/public/wp-content/plugins/woo-razorpay/includes/plugin-instrumentation.php on line 265
cURL error 77: error setting certificate verify locations:
? CAfile: /www/<SITENAME>/public/wp-includes/Requests/Transport/cacert.pem
? CApath: /etc/ssl/certs
PHP Warning: ?Undefined array key "HTTP_HOST" in /www/<SITENAME>/public/wp-content/plugins/woo-razorpay/includes/plugin-instrumentation.php on line 265
Warning: Undefined array key "HTTP_HOST" in /www/<SITENAME>/public/wp-content/plugins/woo-razorpay/includes/plugin-instrumentation.php on line 265
WordPress version: 6.1.3
I tried reaching out via razorpay support but your site wont take the form submission.
]]>We’ve recently observed this error log message a couple times:
'PHP message: PHP Warning: Undefined array key "HTTP_HOST" in /home/www/htdocs/wp-content/advanced-cache.php on line 12; PHP message: PHP Warning: Undefined array key "HTTP_HOST" in /home/www/htdocs/wp-content/advanced-cache.php on line 13; PHP message: PHP Warning: Undefined array key "HTTP_HOST" in /home/www/htdocs/wp-content/advanced-cache.php on line 200'
Per the wp-cli handbook, the fix seems to be to add something to advanced-cache.php along the lines of:
if ( ! isset( $_SERVER['HTTP_HOST'] ) ) {
$_SERVER['HTTP_HOST'] = 'example.com';
}
I wonder what your thoughts are on this.
]]>Notice: Undefined index: HTTP_HOST in …/wp-content/plugins/simple-301-redirects/wp-simple-301-redirects.php on line 170
Please fix.
]]>We have been getting the following error each time we run any WP-CLI command:
Notice: Undefined index: HTTP_HOST in \public\wp-content\plugins\breeze\inc\minification\breeze-minify-main.php on line 27
It’s safe to ignore but it appears at the beginning of each command output so, after many months of seeing it, we’ve decided to report it. We understand this plugin isn’t doing anything in our local environment but we shouldn’t have to deactivate the plugin for this error to go away.
As a suggestion, it might help if this line was added above line 27 in breeze\inc\minification\breeze-minify-main.php to avoid the error in WP-CLI context:
if(!isset($_SERVER['HTTPS'])) return;
Notice: Undefined index: HTTP_HOST in /wp-content/plugins/woo-product-feed-pro/woocommerce-sea.php on line 164
I have re-installed a clean copy of s2Member, and am still getting this error.
]]>PHP Notice: Undefined index: HTTP_HOST in …../wp-content/plugins/really-simple-ssl/class-front-end.php on line 103
I have really simple ssl : 3.0.2 on wordpress 4.97
running on php 7.2
Any ideas on how to fix it ?
]]>filmfix.net/blog/
, this is a link to a post at filmfix.net and the same post here at filmfix.com, using the same default folder. So far so good. Now I noticed that all the links within the .com website go to the default .net website — instead of staying on the .com site. How can I fix this? Do I have to use sub-folders?
Would having a virtual folder that point back to the WP site root folder work?
Switching between $_SERVER[“SERVER_NAME”] (default) and $_SERVER[“HTTP_HOST”] made no difference.
]]>$this->domain = $this->originalDomain;
which results in home page always redirecting to original domain.
Could you please fix it and use normal $_SERVER variables to determine domain instead of filter_input function?
Read comment from “anthony dot parsons at manx dot net” here for some details: https://php.net/manual/en/function.filter-input.php or google for ‘filter_input INPUT_SERVER returns null’ for bug confirmation.
]]>