WordPress Quick App: remove automated WP_SITEURL / WP_HOME constants from wp-config.php

  • | 771 points

    Hey @leokhoa ,

    I've seen on a previous post ( https://forum.laragon.org/topic/1273/notice-undefined-index-request_scheme-in-thrown-in-wp-cli ) that by default Quick App was adding

    define( 'WP_SITEURL', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] ); & define( 'WP_HOME', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] );

    Then it was wrapped with the if ( !defined('WP_CLI') ) { as well.

    I'm not sure why those lines are added, but they shouldn't.

    Here's why:

    1] WordPress has the 5-minute install for the specific reason that it should be accessible even for people without much knowledge. That install takes care of URLs & PATHs as well during that time, configuring the .htaccess and the database entries. So there's no need for any definitions in wp-config.php from the get-go.

    2] By adding the ! defined( 'WP_CLI' ) you are forcing WordPress to always redirect to a siteurl & home that are not yet defined especially when an installation doesn't exist. There's no need to do that.

    3] If you DO NOT use the Auto Virtual Hosts option and you want to use the http://localhost/subfolder scheme those defines will always redirect you to http://localhost/ ( there's no REQUEST_URI ) defined there so the full path is getting stripped off. This makes it impossible for people who are not fully tech-savvy to understand what is going on as their installation always ends up on a "Not found" page due to the wrong redirect.

    I'm not really sure why those lines were added but there's no need to have them at all in my opinion :) .

    You can of course continue to generate the wp-config.php and adjust the database credentials to make it even easier but that's about it, nothing else needs to be touched by default from Laragon itself.

    I hope the above reasons make it clear of why those 2 constant definitions might end up doing more damage than good and you could re-consider on removing them on the next release.

    Thanks !

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.