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

Open Beginner friendly
#570 0 comments 0 reactions 0 assignees View on GitHub

@dhrupo is already working on this.

Since Nov 6, 2026.

  • #571 by @dhrupo — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php, wordpress
Domain
cli

Research direction

Read Theme_Mod_Command::set() where the issue says the mismatched value is detected and the failure message is printed. Check how neighboring command failures report errors and set exit status; reproduce with the described pre_set_theme_mod_background_color filter. Done means the command prints Error: Could not update theme mod background_color. and exits with code 1.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Gherkin
Stars
90
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wp-cli/extension-command

All issues in wp-cli/extension-command

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.