{"id":12700,"date":"2025-07-24T14:32:58","date_gmt":"2025-07-24T08:47:58","guid":{"rendered":"https:\/\/nestnepal.com\/blog\/?p=12700"},"modified":"2025-08-13T16:27:36","modified_gmt":"2025-08-13T10:42:36","slug":"wp-cli-bulk-wordpress-maintenance-plugin-update","status":"publish","type":"post","link":"https:\/\/nestnepal.com\/blog\/wp-cli-bulk-wordpress-maintenance-plugin-update\/","title":{"rendered":"Using WP-CLI for Bulk Site Maintenance and Updates"},"content":{"rendered":"\n<p>Managing multiple <a href=\"https:\/\/nestnepal.com\/wordpress-hosting-in-nepal\/\">WordPress sites<\/a> can quickly become a nightmare when you&#8217;re clicking through dashboards, manually updating plugins, and running the same maintenance tasks over and over. WP-CLI changes that game entirely by letting you automate bulk operations across dozens or even hundreds of sites from a single command line.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"221\" height=\"228\" data-src=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/07\/image-22.png\" alt=\"\" class=\"wp-image-12702 lazyload\" style=\"--smush-placeholder-width: 221px; --smush-placeholder-aspect-ratio: 221\/228;width:183px;height:auto\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p>Whether you&#8217;re managing a small agency portfolio or enterprise-level multisite networks, WP-CLI transforms tedious manual work into efficient, scriptable commands that save hours of repetitive clicking.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What Makes WP-CLI Perfect for Bulk Operations<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"730\" height=\"365\" data-src=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/07\/image-21.png\" alt=\"wp-cli\" class=\"wp-image-12701 lazyload\" data-srcset=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/07\/image-21.png 730w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/07\/image-21-300x150.png 300w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/07\/image-21-380x190.png 380w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/07\/image-21-550x275.png 550w\" data-sizes=\"(max-width: 730px) 100vw, 730px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 730px; --smush-placeholder-aspect-ratio: 730\/365;\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.reddit.com\/r\/Wordpress\/comments\/1bvnev2\/wpcli_what_is_it_good_for\/\" target=\"_blank\" rel=\"noopener\">WP-CLI<\/a> isn&#8217;t just a convenience tool; it&#8217;s built specifically for scenarios where the WordPress admin interface falls short. When you need to update 50 sites, check plugin versions across your entire network, or run database cleanups on multiple installations, the web interface becomes a bottleneck.<\/p>\n\n\n\n<p>The real power comes from WP-CLI&#8217;s ability to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Execute identical commands across multiple sites instantly<\/li>\n\n\n\n<li>Generate detailed reports on site status and health<\/li>\n\n\n\n<li>Automate routine maintenance that would otherwise require manual intervention<\/li>\n\n\n\n<li>Handle operations that would time out or fail in browser-based environments<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Essential Setup for Multi-Site Management<\/strong><\/h2>\n\n\n\n<p>Before diving into bulk operations, you need WP-CLI to be properly configured for your environment. Most hosting providers now include WP-CLI by default, but if you&#8217;re on a VPS or dedicated server, installation is straightforward:<\/p>\n\n\n\n<p># Download and install WP-CLI<\/p>\n\n\n\n<p>curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/wp-cli\/v2.8.1\/phar\/wp-cli.phar<\/p>\n\n\n\n<p>chmod +x wp-cli.phar<\/p>\n\n\n\n<p>sudo mv wp-cli.phar \/usr\/local\/bin\/wp<\/p>\n\n\n\n<p># Verify installation<\/p>\n\n\n\n<p>wp &#8211;info<\/p>\n\n\n\n<p>For bulk operations, organize your sites in a consistent directory structure. This makes scripting much easier:<\/p>\n\n\n\n<p>\/var\/www\/<\/p>\n\n\n\n<p>\u251c\u2500\u2500 client1-site.com\/<\/p>\n\n\n\n<p>\u251c\u2500\u2500 client2-blog.com\/<\/p>\n\n\n\n<p>\u251c\u2500\u2500 agency-portfolio.com\/<\/p>\n\n\n\n<p>\u2514\u2500\u2500 ecommerce-store.com\/<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Core Bulk Update Commands<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Plugin Management Across Multiple Sites<\/strong><\/h3>\n\n\n\n<p>Keeping plugins updated is probably the most common bulk operation. Here&#8217;s how to handle it efficiently:<\/p>\n\n\n\n<p># Check plugin status across all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Checking: $(basename &#8220;$dir&#8221;)&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; plugin list &#8211;update=available<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Update all plugins on all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Updating plugins for: $(basename &#8220;$dir&#8221;)&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; plugin update &#8211;all<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Update specific plugin across all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; plugin update woocommerce<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>WordPress Core Updates<\/strong><\/h3>\n\n\n\n<p>Core updates require a bit more caution, but WP-CLI makes them manageable:<\/p>\n\n\n\n<p># Check WordPress version across all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;site=$(basename &#8220;$dir&#8221;)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;version=$(wp &#8211;path=&#8221;$dir&#8221; core version)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;$site: $version&#8221;<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Download core updates (without installing)<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; core download &#8211;version=latest &#8211;force<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Update WordPress core with backup<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Updating core for: $(basename &#8220;$dir&#8221;)&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; db export &#8220;backup-$(date +%Y%m%d).sql&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; core update<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Theme Management<\/strong><\/h3>\n\n\n\n<p>Theme updates follow similar patterns but often require more selective handling:<\/p>\n\n\n\n<p># List all active themes<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;site=$(basename &#8220;$dir&#8221;)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;theme=$(wp &#8211;path=&#8221;$dir&#8221; theme list &#8211;status=active &#8211;field=name)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;$site: $theme&#8221;<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Update all themes<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; theme update &#8211;all<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Database Maintenance Operations<\/strong><\/h2>\n\n\n\n<p>Database maintenance is where WP-CLI shines for bulk operations. These tasks would be incredibly time-consuming through the admin interface:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Database Optimization<\/strong><\/h3>\n\n\n\n<p># Optimize databases across all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Optimizing database for: $(basename &#8220;$dir&#8221;)&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; db optimize<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Clean up spam comments, revisions, and transients<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; comment delete $(wp &#8211;path=&#8221;$dir&#8221; comment list &#8211;status=spam &#8211;format=ids)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; post delete $(wp &#8211;path=&#8221;$dir&#8221; post list &#8211;post_status=trash &#8211;format=ids)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; transient delete &#8211;all<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Database Repairs and Checks<\/strong><\/h3>\n\n\n\n<p># Check database integrity<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Checking: $(basename &#8220;$dir&#8221;)&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; db check<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Repair databases if needed<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; db repair<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>User Management Across Sites<\/strong><\/h2>\n\n\n\n<p>Managing users becomes much simpler with WP-CLI, especially when you need to make changes across multiple sites:<\/p>\n\n\n\n<p># Create admin user across all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; user create agency_admin admin@agency.com \\<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8211;role=administrator &#8211;user_pass=secure_password<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Update user passwords<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; user update admin &#8211;user_pass=new_secure_password<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># List all administrator users<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;site=$(basename &#8220;$dir&#8221;)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Admins for $site:&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; user list &#8211;role=administrator &#8211;field=user_email<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Advanced Bulk Operations<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Media Library Maintenance<\/strong><\/h3>\n\n\n\n<p># Regenerate thumbnails across all sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Regenerating thumbnails for: $(basename &#8220;$dir&#8221;)&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; media regenerate &#8211;yes<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Clean up unused media files<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; media import &#8211;featured_image<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Search and Replace Operations<\/strong><\/h3>\n\n\n\n<p>This is particularly useful when moving sites or updating URLs:<\/p>\n\n\n\n<p># Update URLs across multiple sites<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; search-replace &#8216;http:\/\/olddomian.com&#8217; &#8216;https:\/\/newdomain.com&#8217;<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p># Update email addresses<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; search-replace &#8216;old@email.com&#8217; &#8216;new@email.com&#8217;<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Creating Comprehensive Maintenance Scripts<\/strong><\/h2>\n\n\n\n<p>For regular maintenance, create shell scripts that combine multiple operations:<\/p>\n\n\n\n<p>#!\/bin\/bash<\/p>\n\n\n\n<p># bulk-maintenance.sh<\/p>\n\n\n\n<p>SITES_DIR=&#8221;\/var\/www&#8221;<\/p>\n\n\n\n<p>LOG_FILE=&#8221;\/var\/log\/wp-maintenance-$(date +%Y%m%d).log&#8221;<\/p>\n\n\n\n<p>echo &#8220;Starting bulk maintenance: $(date)&#8221; &gt;&gt; $LOG_FILE<\/p>\n\n\n\n<p>for dir in $SITES_DIR\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;if [ -f &#8220;$dir\/wp-config.php&#8221; ]; then<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;site=$(basename &#8220;$dir&#8221;)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Processing: $site&#8221; &gt;&gt; $LOG_FILE<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Create backup<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; db export &#8220;backup-$site-$(date +%Y%m%d).sql&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Update everything<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; core update &gt;&gt; $LOG_FILE 2&gt;&amp;1<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; plugin update &#8211;all &gt;&gt; $LOG_FILE 2&gt;&amp;1<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; theme update &#8211;all &gt;&gt; $LOG_FILE 2&gt;&amp;1<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Clean up<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; transient delete &#8211;all<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp &#8211;path=&#8221;$dir&#8221; db optimize<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;Completed: $site&#8221; &gt;&gt; $LOG_FILE<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;fi<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<p>echo &#8220;Bulk maintenance completed: $(date)&#8221; &gt;&gt; $LOG_FILE<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Monitoring and Reporting<\/strong><\/h2>\n\n\n\n<p>Generate comprehensive reports on your site network:<\/p>\n\n\n\n<p># Site health report<\/p>\n\n\n\n<p>echo &#8220;Site Health Report &#8211; $(date)&#8221;<\/p>\n\n\n\n<p>echo &#8220;==================================&#8221;<\/p>\n\n\n\n<p>for dir in \/var\/www\/*\/; do<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;site=$(basename &#8220;$dir&#8221;)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;wp_version=$(wp &#8211;path=&#8221;$dir&#8221; core version)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;active_plugins=$(wp &#8211;path=&#8221;$dir&#8221; plugin list &#8211;status=active &#8211;format=count)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;$site | WP: $wp_version | Plugins: $active_plugins&#8221;<\/p>\n\n\n\n<p>done<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Operation<\/strong><\/td><td><strong>Single Site Time<\/strong><\/td><td><strong>Bulk Time (10 sites)<\/strong><\/td><td><strong>Time Saved<\/strong><\/td><\/tr><tr><td>Plugin Updates<\/td><td>5 minutes<\/td><td>2 minutes<\/td><td>48 minutes<\/td><\/tr><tr><td>Core Updates<\/td><td>3 minutes<\/td><td>1 minute<\/td><td>29 minutes<\/td><\/tr><tr><td>Database Cleanup<\/td><td>10 minutes<\/td><td>3 minutes<\/td><td>97 minutes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Security Considerations<\/strong><\/h2>\n\n\n\n<p>When running bulk operations, security becomes even more critical:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always create database backups before major updates<\/li>\n\n\n\n<li>Use strong passwords when creating bulk users<\/li>\n\n\n\n<li>Test scripts on staging environments first<\/li>\n\n\n\n<li>Monitor logs for failed operations<\/li>\n\n\n\n<li>Implement proper file permissions on your scripts<\/li>\n<\/ul>\n\n\n\n<p># Secure your maintenance scripts<\/p>\n\n\n\n<p>chmod 700 bulk-maintenance.sh<\/p>\n\n\n\n<p>chown root:root bulk-maintenance.sh<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting Common Issues<\/strong><\/h2>\n\n\n\n<p><strong>Memory Limits<\/strong>: Large bulk operations can hit PHP memory limits. Increase limits in wp-config.php:<\/p>\n\n\n\n<p>ini_set(&#8216;memory_limit&#8217;, &#8216;512M&#8217;);<\/p>\n\n\n\n<p><strong>Timeouts<\/strong>: For operations on many sites, break them into smaller batches:<\/p>\n\n\n\n<p># Process sites in batches of 5<\/p>\n\n\n\n<p>sites=($(find \/var\/www -name &#8220;wp-config.php&#8221; -path &#8220;*\/public_html\/*&#8221; | head -5))<\/p>\n\n\n\n<p><strong>Permission Issues<\/strong>: Ensure WP-CLI runs with appropriate permissions:<\/p>\n\n\n\n<p># Run as web server user<\/p>\n\n\n\n<p>sudo -u www-data wp plugin update &#8211;all<\/p>\n\n\n\n<p>WP-CLI transforms WordPress maintenance from a tedious manual process into an efficient, automated workflow. Whether you&#8217;re managing 5 sites or 500, these bulk operations will save you countless hours while ensuring consistent maintenance across your entire network. The initial time investment in setting up proper scripts pays dividends every single maintenance cycle.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Managing multiple WordPress sites can quickly become a nightmare when you&#8217;re clicking through dashboards, manually updating plugins, and running the&#8230;<\/p>\n","protected":false},"author":15,"featured_media":13016,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[373],"class_list":["post-12700","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-hosting","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/posts\/12700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/comments?post=12700"}],"version-history":[{"count":1,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/posts\/12700\/revisions"}],"predecessor-version":[{"id":12703,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/posts\/12700\/revisions\/12703"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/media\/13016"}],"wp:attachment":[{"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/media?parent=12700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/categories?post=12700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/wp-json\/wp\/v2\/tags?post=12700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}