Last active
June 22, 2022 02:56
-
-
Save nawawi/0cd920bf641fbe1b9d4948d946de14f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('plugins_loaded', function() { | |
if ( is_multisite() ) { | |
$sites = get_sites(); | |
foreach ( $sites as $site ) { | |
switch_to_blog( $site->blog_id ); | |
$old_siteurl = get_option('siteurl'); | |
$old_homeurl = get_option('home'); | |
$new_siteurl = str_replace('http://', 'https://', $old_siteurl); | |
$new_homeurl = str_replace('http://', 'https://', $old_homeurl); | |
update_option('siteurl', $new_siteurl); | |
update_option('home', $new_homeurl); | |
restore_current_blog(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment