File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,6 +180,65 @@ Feature: Manage WordPress options
180180 | option_name | option_value | autoload |
181181 | hello | island | on |
182182
183+ @require-wp-4.2
184+ @less-than-wp-6.6
185+ Scenario: Update autoload value for custom option with an unchanged value
186+ Given a WP install
187+ And I run `wp option add hello world --autoload=yes`
188+
189+ When I run `wp option update hello world --autoload=no`
190+ Then STDOUT should be:
191+ """
192+ Success: Updated autoload value for 'hello' option.
193+ """
194+
195+ When I run `wp option get-autoload hello`
196+ Then STDOUT should be:
197+ """
198+ no
199+ """
200+
201+ When I run `wp option update hello world --autoload=yes`
202+ Then STDOUT should be:
203+ """
204+ Success: Updated autoload value for 'hello' option.
205+ """
206+
207+ When I run `wp option get-autoload hello`
208+ Then STDOUT should be:
209+ """
210+ yes
211+ """
212+
213+ @require-wp-6.6
214+ Scenario: Update autoload value for custom option with an unchanged value
215+ Given a WP install
216+ And I run `wp option add hello world --autoload=on`
217+
218+ When I run `wp option update hello world --autoload=off`
219+ Then STDOUT should be:
220+ """
221+ Success: Updated autoload value for 'hello' option.
222+ """
223+
224+ When I run `wp option get-autoload hello`
225+ Then STDOUT should be:
226+ """
227+ off
228+ """
229+
230+ When I run `wp option update hello world --autoload=on`
231+ Then STDOUT should be:
232+ """
233+ Success: Updated autoload value for 'hello' option.
234+ """
235+
236+ When I run `wp option get-autoload hello`
237+ Then STDOUT should be:
238+ """
239+ on
240+ """
241+
183242 @require-wp-4.2
184243 @less-than-wp-6.6
185244 Scenario: Managed autoloaded options
Original file line number Diff line number Diff line change @@ -454,6 +454,8 @@ public function update( $args, $assoc_args ) {
454454
455455 if ( $ value === $ old_value && null === $ autoload ) {
456456 WP_CLI ::success ( "Value passed for ' {$ key }' option is unchanged. " );
457+ } elseif ( $ value === $ old_value ) {
458+ $ this ->set_autoload ( [ $ key , $ autoload ] );
457459 // @phpstan-ignore argument.type
458460 } elseif ( update_option ( $ key , $ value , $ autoload ) ) {
459461 WP_CLI ::success ( "Updated ' {$ key }' option. " );
You can’t perform that action at this time.
0 commit comments