On Install, which code sets the ‘home’ option?

I’m just doing some wordpress development and wondered for a brand new install, which code within core is generating the first value that get’s filled into the home option?

I’m looking for the code in core, e.g. the filename and the line where this happens.

Read More

Does someone remembers from mind?

Related posts

Leave a Reply

1 comment

  1. When the installer runs it calls wp_install(), that in turn calls populate_options() defined in wp-admin/includes/schema.php, which runs the following..

    if ( !__get_option('home') ) update_option('home', $guessurl);
    

    Prior to that $guessurl is defined by..

    $guessurl = wp_guess_url();
    

    The guess URL function is defined in wp-includes/functions.php and looks like this.

    function wp_guess_url() {
        if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
            $url = WP_SITEURL;
        } else {
            $schema = is_ssl() ? 'https://' : 'http://';
            $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        }
        return rtrim($url, '/');
    }
    

    Hope that’s the info you’re looking for… 🙂