`wp theme mod set` prints its failure message as `Success` and exits 0

未關閉 適合新手
#570 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

@dhrupo 已經在處理了。

開始於 2026年11月6日。

  • #571 來自 @dhrupo —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
82/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
php, wordpress
領域
cli

研究方向

閱讀 Theme_Mod_Command::set(),issue指出這裡會偵測到不相符的值並印出失敗訊息。檢查相鄰命令失敗時如何回報錯誤並設定結束狀態;使用描述的篩選器 pre_set_theme_mod_background_color 重現問題。完成標準是命令印出 Error: Could not update theme mod background_color. 並以代碼 1 結束。

由索引模型根據 Issue 內容生成。

描述

bug command:theme-mod-set status:unconfirmed

When wp theme mod set cannot save the value, it prints the failure through WP_CLI::success():

$ wp theme mod set background_color 123456
Success: Could not update theme mod background_color.
$ echo $?
0

To reproduce, add a pre_set_theme_mod_background_color filter that returns a different value (for example from a mu-plugin). Theme_Mod_Command::set() reads the mod back, sees it does not match, and calls WP_CLI::success( "Could not update theme mod {$mod}." ). Scripts that check the exit code treat the failure as a success.

Expected: Error: Could not update theme mod background_color. with exit code 1.

主要語言
Gherkin
星號
90
分支
87
平均合併
2 天 7 小時
30 天內合併 PR
3

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

wp-cli/extension-command 的其他 Issue

查看 wp-cli/extension-command 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。