I'm creating a new lightswitch field and adding it to an entry type in a section which already has dozens of entries. I want the lightswitch to be default set to 'on'.

When I save the entry type with the lightswitch field added to a tab, then inspect an entry in that section, the new lightswitch field is set to 'off'. Is this a bug?

2 Answers 2


For entries previously created, the lightswitch field will not be on even if you specified that as a field option. However, new entries should respect that field setting.

Are new entries not honoring your field settings?

  • I see, I did not expect that behaviour, you are correct in that is what I am experiencing. Presumably I'd have to write a plugin to re-save entries with the 'on' value set. Commented Feb 21, 2017 at 20:52
  • @AdamMenczykowski If you're comfortable with SQL, you could update the value of light switch field in the content table for entry elements in the desired section. Not super simple but should be quick and painless if you can write the SQL with a couple criteria in the where clause. Commented Feb 21, 2017 at 21:57
  • Could anyone provide example code on how to write SQL query code to enable all lightswitches on existing entries please? Commented Jan 4, 2018 at 12:04
  • I too would like example sql code
    – CreateSean
    Commented Aug 22, 2018 at 16:34
  • Is there no way of selecting all entries in a structure and re-saving all at once? Commented Jun 5, 2019 at 15:25

This is the mySQL query I have used to update a lightswitch field in the database.

UPDATE `table` SET `field_name` = replace(field_name,'original content', 'updated content')

for example:

UPDATE `craft_content` SET `field_imageLightbox` = replace(field_imageLightbox,'0', '1')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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