WP-CLI 3.0: the activation redirect silently ends the next `wp plugin` / `wp theme` command
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
Rechercherichtung
Beginne in inc/admin.php bei Admin::maybe_redirect(), der im Issue genannten Weiterleitung nach der Aktivierung, und prüfe, wie sie das Weiterleitungsflag liest und löscht. Reproduziere das Problem mit den beiden WP-CLI-Befehlen im Issue, füge dann die dort beschriebene vorzeitige Rückgabe hinzu und überprüfe, dass der nächste Befehl ausgeführt wird und die Weiterleitung auf der ersten wp-admin-Seite weiterhin funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What happens
WP-CLI 3.0 (stable since 2026-12-01) changed its default context from cli to auto, which runs wp plugin … and wp theme … commands as a wp-admin page load for an administrator, so admin_init fires. Optimole's one-time redirect after activation, Admin::maybe_redirect() (https://github.com/Codeinwp/optimole-wp/blob/31e2a5c8d039998cfd2921544d3655d1878fb316/inc/admin.php#L1137), then calls wp_safe_redirect() and exit. WP-CLI suppresses the redirect header (wp-cli/wp-cli#6279) but not the exit, so the first such command after activating Optimole ends with exit code 0, no output, and having done nothing.
A deploy or provisioning script that activates Optimole and then runs another plugin or theme command silently skips that step: an install that never happens, a theme that is not activated, a deactivation that does not happen, or wp plugin is-installed answering success for a missing plugin. Only one command is affected, because the redirect clears its flag.
Reproduce
wp plugin activate optimole-wp
wp plugin install hello-dolly # WP-CLI 3.0.x: prints nothing, exit 0, nothing installed
Measured on a local WordPress site with the current release of Optimole: under WP-CLI 3.0.1 the wp plugin install above printed nothing, exited 0 and installed nothing; under WP-CLI 2.12.0 the same steps installed the plugin.
Suggested fix
Return before the flag is read or cleared when running under WP-CLI, so the redirect still happens on the administrator's first wp-admin page:
if ( defined( 'WP_CLI' ) && WP_CLI ) {
return;
}
This is how Easy MCP AI fixed the same bug in App_Page::maybe_redirect() (Codeinwp/wp-plugin-easy-mcp@c2ef3e341, with a unit test). Other Codeinwp products were checked the same way; the same issue is open in each affected one:
- Codeinwp/hyve-lite#325
- Codeinwp/optimole-wp#1259
- Codeinwp/otter-blocks#3238
- Codeinwp/redirection-for-contact-form-7#332
- Codeinwp/sparks-for-woocommerce#441
- Codeinwp/templates-patterns-collection#554
- Codeinwp/WP-Cloudflare-Super-Page-Cache#899
- Codeinwp/wp-full-stripe#853
- Codeinwp/wp-maintenance-mode#615
- Vorherrschende Sprache
- PHP
- Sterne
- 75
- Forks
- 14
- Ø Merge
- 1 T. 6 Std.
- Gemergte PRs (30 T.)
- 31
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Codeinwp/optimole-wp
-
bug-report bug-report-triage customer report
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
Codeinwp/optimole-wp#1255 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Lazyload SVG placeholder runs uncached attachment lookups with JSON-escaped URLs on REST responsesOffencustomer report
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Codeinwp/optimole-wp#1253 ·
Maintainer antworten meist innerhalb von 1 Tag
-
customer report feature-request-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Codeinwp/optimole-wp#1239 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Throttle and optimize `/wp-json/optml/v1/optimizations` REST API endpoint execution and validationOffencustomer report feature-request-triage
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
Codeinwp/optimole-wp#1250 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Cache `attachment_url_to_postid()` lookups in `Optml_Lazyload_Replacer` to reduce database overheadOffencustomer report feature-request-triage
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
Codeinwp/optimole-wp#1249 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in Codeinwp/optimole-wp
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
repo:ckeditor
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
craftcms/ckeditor#682 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
component/core domain/framework
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 75/100