5

I have a site with a hundred+ or so entries. I've added a new field to my entry template, but it won't take effect until it's been activated by a onSaveEntry event.

I've gone through maybe 15 entries or so now and resaved them manually, but it's proving to be a long and painstaking process.

Is there a way for me to batch resave all enabled entries in order to trigger this onSaveEntry event?

2 Answers 2

13

If you re-save the section(s) that your entries are in, it should re-trigger a save of all of the entries.

Hope that helps!

7
  • 1
    This is the correct answer, I don't see why it was down voted. Go to "Settings > Sections" and then the section containing your entries and hit save. This will trigger a bulk re-save of all of the entries.
    – Fyrebase
    Jan 10, 2017 at 0:02
  • 1
    ¯_(ツ)_/¯ - got my upvote.
    – Brad Bell
    Jan 10, 2017 at 0:38
  • 1
    This did in fact resave all entries (there was a task that ran in my sidebar confirming as much: cl.ly/221m2V0p2i41). Didn't seem to trigger the onSaveEntry event though; my field's values have gone unchanged. Is this intentional or am I missing something? Jan 10, 2017 at 14:32
  • 2
    I have this exact problem with 2000+ entries, how did you eventually manage to do this? Re saving the section doesn't work
    – Branko
    Sep 1, 2017 at 10:02
  • 2
    Two-year-ago Jake, you beauty. Thanks! Works great in Craft 3.
    – Jay
    Jan 14, 2019 at 10:46
5

Craft can now do this via the CLI

https://craftcms.com/docs/3.x/console-commands.html#resave-entries

1
  • 1
    Does this trigger events like Entry::EVENT_BEFORE_SAVE? I can get the command line resave/entries to work but Events don't seem to be firing. Mar 1, 2022 at 16:07

Your Answer

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

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