3

And why clearing cache is not enough?

1
  • Do you know if something happened since this? Is there a way to batch save now in April 2019? Or maybe someone knows of a plugin? I have this exact issue to fix for 50 entries... – mateostabio Apr 15 '19 at 16:43
3

Dropdown fields (and other simple option-based fieldtypes such as Radio Buttons, Checkboxes and Multi Select) are pretty dumb.

By design, whenever an Entry with a Dropdown field is saved, Craft simply grabs the selected value for that Dropdown field and stores it in the database for that Entry. Unlike relational fields such as Assets or Categories, there's no "connection" (i.e. relation) between the selected value being stored, and the Dropdown fields' option where the value was pulled from – this means that if you later decide to rename a Dropdown fields' option value from e.g. "foo" to "bar", the selected value for any existing entries will not change/update. In other words, any entries that had "foo" selected, will still have "foo" stored as their value for that particular field, even if that option doesn't exist anymore.

The easiest way to bulk update entries' selected Dropdown values is probably to execute an SQL query.

Something like the below should work (the following example would update the selected value for a field with the handle myDropdownField from "foo" to "bar", for all entries that have "foo" selected):

UPDATE craft_content SET field_myDropdownField = 'bar' WHERE field_myDropdownField = 'foo';

To run this query, you'll need some sort of SQL client – for Mac, Sequel Pro is very decent, and free. You can also use something like Adminer.

Oh, and don't forget to back up your database before running any manual SQL query, and to clear out your caches after you're done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.