Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Users attempting to install plugins via WordPress.org directory URLs (e.g., https://wordpress.org/plugins/akismet/) encounter PCLZIP errors because the code treats these URLs as direct ZIP downloads, which they are not.

Changes

URL Detection in CommandWithUpgrade::install()

  • Added regex pattern matching to detect WordPress.org directory URLs: ~^https?://wordpress\.org/(plugins|themes)/([^/]+)/?~
  • Extracts slug from matched URLs and routes installation through repository flow instead of ZIP download flow
  • Logs detection for user visibility: Detected WordPress.org plugins directory URL, using slug: akismet

Updated Command Documentation

  • Modified parameter descriptions in Plugin_Command and Theme_Command to indicate directory URL support
  • Added usage examples demonstrating the new capability

Test Coverage

  • Added scenarios for plugin and theme installation via directory URLs, with and without activation flags

Example Usage

# All these formats now work identically:
wp plugin install akismet
wp plugin install https://downloads.wordpress.org/plugin/akismet.zip
wp plugin install https://wordpress.org/plugins/akismet/

# Activation flags work as expected:
wp theme install https://wordpress.org/themes/twentytwelve/ --activate

The implementation preserves existing behavior for direct ZIP URLs, GitHub URLs, and plain slugs.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.wordpress.org
    • Triggering command: /usr/bin/curl curl -s REDACTED grep -l hUpgrade mmand/vendor/behat/behat/src/Behat/Config/Suite.php ep hUpgrade tainerLoader.phprev-list mposer/vendor/biremotes/origin/main..copilot/fix-plugin-install-zip-error grep -l '-d short_open_tag=Off' '-d error_reporting=E_ALL' '-n' '-l' './src/Plugin_Command.php' mmand/src/Theme_Command.php /home/REDACTED/.config/composer/vendor/bin/grep hUpgrade t/LifecycleEvent/home/REDACTED/work/extension-command/extension-command/vendor/bin/run-phpstan-tes--no-abbrev grep grep (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED -main/dist/ripgrep/bin/linux-x64origin -l hUpgrade mmand/src/WP_CLI/CommandWithUpgrade.php /usr/bin/grep hUpgrade er/EventDispatch-c tnet/tools/grep grep -l hUpgrade and/extension-command/vendor/behat/behat/src/Behat/Config/Suite.php ndor/bin/grep hUpgrade er.php ep grep (dns block)
  • downloads.wordpress.org
    • Triggering command: /usr/bin/curl curl -sSfL REDACTED grep -l hUpgrade and/extension-command/vendor/beh-l rgo/bin/grep hUpgrade ter.php n/grep grep /wp hUpgrade and/extension-command/src/WP_CLI/ParseThemeNameInput.php mposer/vendor/bin/grep hUpgrade Printer.php rep grep (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Unable to install plugin by plugin directory URL</issue_title>
<issue_description>## Bug Report

Describe the current, buggy behavior
plugin install fails with ZIP error. php 8.3 and php 8.4

A clear and concise description of the behavior that produces a wrong result or error.
PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

Remember to provide some context to make sure we're all on the same page when reasoning about this.

Describe how other contributors can replicate this bug

wp plugin install --path='/path/htdocs' --skip-themes --skip-packages --activate 'https://wordpress.org/plugins/orbisius-seo-editor/'

Describe what you would expect as the correct outcome
a plugin to be installed and activated. It used to work.

Downloading installation package from https://wordpress.org/plugins/orbisius-seo-editor/...
Unpacking the package...
Warning: The package could not be installed. "PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature"
Warning: The 'https://wordpress.org/plugins/orbisius-seo-editor/' plugin could not be found.
Error: No plugins installed.
Exit Status: 1 exit status 1

Let us know what environment you are running this on

(Paste the output of "wp cli info" into this box)
I have a tool that switches to a given user. Just sets uid and runs wp-cli
owp cli info
OS:	Linux 6.8.0-59-generic wp-cli/extension-command#61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:03:15 UTC 2 x86_64
Shell:	/bin/bash
PHP binary:	/usr/bin/php8.4
PHP version:	8.4.6
php.ini used:	/etc/php/8.4/cli/php.ini
MySQL binary:	/usr/bin/mariadb
MySQL version:	mariadb  Ver 15.1 Distrib 10.6.21-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:	
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	phar:///usr/local/bin/wp
WP-CLI packages dir:	
WP-CLI cache dir:	/root/.wp-cli/cache
WP-CLI global config:	
WP-CLI project config:	
WP-CLI version:	2.12.0


also fails on a server with
OS:     Linux 5.4.0-193-generic wp-cli/extension-command#213-Ubuntu SMP Fri Aug 2 19:14:16 UTC 2024 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php8.3
PHP version:    8.3.11
php.ini used:   /etc/php/8.3/cli/php.ini
MySQL binary:   /usr/bin/mariadb
MySQL version:  mariadb  Ver 15.1 Distrib 10.3.39-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       phar:///usr/local/bin/wp
WP-CLI packages dir:
WP-CLI cache dir:       /dev/null
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.12.0


Provide a possible solution
maybe the issue is with wp org not providing a zip file OR wp-cli can't download the file or it gets broken during transfer ?

full debug

Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\DeclareAbstractBaseCommand (0.008s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludeFrameworkAutoloader (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\ConfigureRunner (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\InitializeColorization (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\InitializeLogger (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\CheckRoot (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludeRequestsAutoloader (0.009s)
Debug (bootstrap): Setting RequestsLibrary::$version to v2 (0.009s)
Debug (bootstrap): Setting RequestsLibrary::$source to wp-core (0.009s)
Debug (bootstrap): Setting RequestsLibrary::$class_name to \WpOrg\Requests\Requests (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\DefineProtectedCommands (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\LoadExecCommand (0.01s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\LoadRequiredCommand (0.01s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludePackageAutoloader (0.01s)
Debug (bootstrap): Skipped loading packages. (0.01s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludeFallbackAutoloader (0.01s)
Debug (bootstrap): Fallback autoloader paths: phar://wp-cli.phar/vendor/autoload.php (0.01s)
Debug (bootstrap): Loading detected autoloader: phar://wp-cli.phar/vendor/autoload.php (0.01s)
Debug (bootstrap): Attaching command 'config edit' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config path' to ho...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes wp-cli/extension-command#452

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copilot AI changed the title [WIP] Fix plugin installation error with ZIP format Support WordPress.org plugin/theme directory URLs in install commands Jan 5, 2026
Copilot AI requested a review from swissspidy January 5, 2026 17:00
@codecov

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review January 5, 2026 19:08
@swissspidy swissspidy requested a review from a team as a code owner January 5, 2026 19:08
@swissspidy swissspidy added command:plugin-install Related to 'plugin install' command command:theme-install Related to 'theme install' command labels Jan 6, 2026
@swissspidy swissspidy linked an issue Jan 10, 2026 that may be closed by this pull request
2 tasks
@swissspidy swissspidy requested a review from Copilot January 10, 2026 10:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for installing WordPress plugins and themes directly from WordPress.org directory URLs (e.g., https://wordpress.org/plugins/akismet/). Previously, users attempting this would encounter PCLZIP errors because the code treated these URLs as direct ZIP downloads.

Changes:

  • Added URL pattern detection in CommandWithUpgrade::install() to identify and extract slugs from WordPress.org directory URLs
  • Updated command documentation in Plugin_Command and Theme_Command to reflect the new capability
  • Added comprehensive test coverage for the new functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/WP_CLI/CommandWithUpgrade.php Added regex pattern matching to detect WordPress.org directory URLs and route them through the repository installation flow instead of treating them as ZIP downloads
src/Plugin_Command.php Updated parameter documentation and added usage examples demonstrating installation from WordPress.org plugin directory URLs
src/Theme_Command.php Updated parameter documentation and added usage examples demonstrating installation from WordPress.org theme directory URLs
features/plugin-install.feature Added test scenarios for installing plugins via directory URLs with and without activation flags
features/theme-install.feature Added test scenarios for installing themes via directory URLs with and without activation flags

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@swissspidy swissspidy added this to the 2.3.0 milestone Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin-install Related to 'plugin install' command command:theme-install Related to 'theme install' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to install plugin by plugin directory URL

2 participants