Opened 7 years ago
Last modified 7 years ago
#48481 new enhancement
don't apply wp_initialize_site_args filter until after wp-admin-includes/update.php is loaded
| Reported by: | pbiron | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Networks and Sites | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | multisite |
Description
A recent slack thread discussed the desire to have sub-domain installs default the siteurl and home options to https (at least on a given install). in that thread it was suggested that one could hook into wp_initialize_site_args to accomplish that.
It would be great if one could hook into wp_initialize_site_args in a custom WP_CONTENT_DIR . '/install.php'. Unfortunately, that isn't loaded until after wp_initialize_site_args is applied.
Therefore, I suggest that wp_initialize_site() should apply wp_initialize_site_args only after wp-admin-includes/update.php has been loaded (that file in turn loads WP_CONTENT_DIR . '/install.php').
Doing that would allow a site owner that new all of the sub-domain sites they were going to add would support https to add something like the following to their WP_CONTENT_DIR . '/install.php:
add_filter( 'wp_initialize_site_args', 'mysite_https_siteurl_and_home' ), 10, 3 ); function mysite_https_siteurl_and_home( $args, $site, $network ) { if ( is_subdomain_install() ) { $args['options'] = array_merge( array( 'home' => untrailingslashit( 'https://' . $site->domain . $site->path ), 'siteurl' => untrailingslashit( 'https://' . $site->domain . $site->path ), ), $args['options'] ); } return $args; }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I don't really use
WP_CONTENT_DIR . '/install.phpbut I could imagine it being useful for default behaviour you wish to invoke such as this.