This WP-CLI plugin makes the process of moving sites from single WordPress sites to a Multisite instance (or vice-versa) much easier. It exports everything into a zip package which can be used to automatically import it within the desired Multisite installation.
MIT License
329
stars
47
forks
source link
create_new_site returning false - replaced insert_blog with wp_insert_site #95
Replaced deprecated function insert_blog() with wp_insert_site().
When running wp mu-migration import all without passing a value for --blog_id, create_new_site() returned false . This update returns the ID of a newly created site and also creates the site.
Error received:
PHP Deprecated: insert_blog is <strong>deprecated</strong> since version 5.1.0! Use wp_insert_site() instead. in .../functions.php on line 4861
Benefits
This fix uses the WP replacement for wp_insert_site(), wp_insert_site() which also returns an int for the ID of the newly created site: https://developer.wordpress.org/reference/functions/wp_insert_site/ . This should simply replace a deprecated function (which is no longer working when testing with WP v5.7.2).
Possible Drawbacks
The array defined as $new_site_meta var includes predefined values for public, archived, mature, etc. These could present a problem if a migration originates from a multisite. My use test case was for a single site origin.
Verification Process
Manually running and local unit tests; have not pushed any new tests with this update.
Description of the Change
Replaced deprecated function
insert_blog()
withwp_insert_site()
.When running
wp mu-migration import all
without passing a value for--blog_id
,create_new_site()
returnedfalse
. This update returns the ID of a newly created site and also creates the site.Error received:
PHP Deprecated: insert_blog is <strong>deprecated</strong> since version 5.1.0! Use wp_insert_site() instead. in .../functions.php on line 4861
Benefits
This fix uses the WP replacement for
wp_insert_site()
,wp_insert_site()
which also returns an int for the ID of the newly created site: https://developer.wordpress.org/reference/functions/wp_insert_site/ . This should simply replace a deprecated function (which is no longer working when testing with WP v5.7.2).Possible Drawbacks
The array defined as $new_site_meta var includes predefined values for public, archived, mature, etc. These could present a problem if a migration originates from a multisite. My use test case was for a single site origin.
Verification Process
Manually running and local unit tests; have not pushed any new tests with this update.
Checklist: