1

I have two sections with the same fields. I want to move entries from one section into the other section. There is this post but its there a better way in Craft 4?

1 Answer 1

1

This can be done using the resave/entries console command along with the --set and --to option flags.

craft resave/entries --section sourceSectionHandle --set sectionId --to "=destinationSectionId"

This resaves all the entries in the section whose handle is 'sourceSectionHandle' and then uses the --set and --to flags to define the destination section ID of the entries, which will move them from the source section to the destination section as they're resaved.

You can find out the ID of the destination section you want to move the entries to by checking the URL in CP > Settings > Sections and edit the section. The URL looks like this:

https://yoursite.local/admin/settings/sections/11

In this example, the section ID is 11, so the resave command would look like this:

craft resave/entries --section sourceSectionHandle --set sectionId --to "=11"

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.