0

I have and existing channel with existing entries. I added a new custom field, a radio button group, with options YES/NO, with the default option being YES.

The field is now available in the edit entry form but it has no value set until I click an option (YES) and then save the form.

Is there a way to set/publish the default value for all existing entries?

1 Answer 1

1

You'll have to run a query on the database to set the past entries' values for this new field:

UPDATE exp_channel_data SET field_id_XX = 'YES' WHERE field_id_XX == '' AND channel_id = X;

Just replace XX with the correct field_id and X with the correct channel_id.

And, as with anytime you run a write query on the database, back it up first!

1
  • I had to change the double '==' to a single '=' and then it worked.
    – JonkBok
    Nov 12, 2015 at 11:18

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.