WordPress Multisite is a powerful feature that allows you to manage multiple WordPress sites from a single WordPress installation. However, managing a WordPress Multisite installation can be a time-consuming task. Fortunately, WP-CLI provides several commands that can help you manage your WordPress Multisite quickly and efficiently. In this post, we’ll explore how to use WP-CLI to manage your WordPress Multisite.
Why Use WP-CLI for Multisite Management?
Using WP-CLI for Multisite management has several advantages over other methods. First, WP-CLI is faster than using the WordPress dashboard. Second, WP-CLI allows you to automate tasks, which can save you time and effort. Third, WP-CLI is more efficient than using plugins, which can be resource-intensive and may not be as effective.
How to Manage WordPress Multisite with WP-CLI
Managing WordPress Multisite with WP-CLI is easy. Here’s how:
Creating a New Site
To create a new site in your WordPress Multisite installation, use the following command:
wp site create --slug=site-slug --title=site-title --email=site-email
Replace “site-slug” with the site’s slug, “site-title” with the site’s title, and “site-email” with the site’s email address.
This command will create a new site in your WordPress Multisite installation with the specified slug, title, and email address.
Listing Sites
To list all the sites in your WordPress Multisite installation, use the following command:
wp site list
This command will list all the sites in your WordPress Multisite installation, including their ID number, URL, and title.
Changing Site URLs
To change a site’s URL in your WordPress Multisite installation, use the following command:
wp site option update site_id siteurl new_url
Replace “site_id” with the ID number of the site you want to update, and “new_url” with the new URL you want to assign to the site.
This command will update the site’s URL with the new URL you specified.
Changing Site Titles
To change a site’s title in your WordPress Multisite installation, use the following command:
wp site option update site_id blogname new_title
Replace “site_id” with the ID number of the site you want to update, and “new_title” with the new title you want to assign to the site.
This command will update the site’s title with the new title you specified.
Deleting Sites
To delete a site from your WordPress Multisite installation, use the following command:
wp site delete site_id
Replace “site_id” with the ID number of the site you want to delete.
This command will delete the specified site from your WordPress Multisite installation.
Conclusion
Managing a WordPress Multisite installation can be a time-consuming task, but with WP-CLI, you can manage your sites quickly and efficiently. By using WP-CLI to create new sites, list existing sites, change site URLs and titles, and delete unwanted sites, you can ensure that your WordPress Multisite installation is functioning as intended and providing the best user experience for your audience. With the steps outlined in this post, you can use WP-CLI to manage your WordPress Multisite installation like a pro.