Is it possible to migrate content like categories from an entry to an asset easily?

Each entry has an image asset and I'd like to move all the categories on the entry to the asset.

Would this require a SQL operation or is there any easier way?


I would probably do this in two steps:

  1. Create a twig file formatted as a CSV that outputs the category and asset id's, i.e.
AssetId, Category<br>
{% for entry in entries %}
{{ entry.asset.one().id }}, {% for category in categories %}{{ category.id }}{% if not loop.last %}-|-{% endif %}{% endfor %}<br>
{% endfor %}
  1. Use feed me to re-import the categories onto the assets using the CSV.
  • Clever! Will try this, thank you! – evvvvritt Oct 23 '20 at 10:04

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.