• Use WP-CLI to Update WordPress Plugins

    Updating plugins via WP-CLI offers many advantages over the traditional method. It’s faster and more reliable because it runs directly on the server, bypassing the WordPress admin interface, AJAX requests, and page reloads. It also helps prevent cache-related issues when you have caching systems like Cloudflare or server-side caching enabled.

    How to update plugins via WP-CLI:

    From the server terminal, cd to the wordpress directory.

    cd /var/www/taihoang/wordpress/Code language: Bash (bash)

    From here, you can use plugin-related commands, such as:

    List all plugins:

    wp plugin listCode language: Bash (bash)

    List all active plugins:

    wp plugin list --status=activeCode language: Bash (bash)

    Deactivate a plugin:

    wp plugin deactivate <plugin-slug>Code language: Bash (bash)

    Use wp plugin list command to know the plugin slugs.

    Deactivate all plugins:

    wp plugin deactivate --allCode language: Bash (bash)

    Update to a specific version (instead of the latest version):

    wp plugin install <plugin-slug> --version=1.0.248 --forceCode language: Bash (bash)

    Update multiple plugins:

    wp plugin update <plugin-slug-1> <plugin-slug-2> <plugin-slug-3>Code language: Bash (bash)

    Update all plugins:

    wp plugin update --allCode language: Bash (bash)

    Done.

    Top ↑