Skip to content

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

Open

Description

@dhrupo

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions