`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 摘要。