1

In Craft, is it possible to map one field containing string value to another?

I have a bunch of image assets that has a title field and altTag fields. I've entered data into the alt tag field, but now I would like to copy that data for each asset into the title field for that same asset.

Doing this manually for each asset would take forever, but it sounds like something that could be done with mysql queries.

I poked around the database to see where the title fields or the altTag fields are stored. The altTag field is in the craft_fields table, and I can see all my assets in the craft_assetfiles table. But title is not one of the columns in this table, I do see the filename column. But I think my knowledge of the structure of craft tables are lacking to find where the values for the altTag fields are stored or how to copy the value of each alt tag into the corresponding title field for the asset.

1

You want to look at the craft_content table. There you should find the title column and the field_altTag column. You could set the title to the field_altTag value where that value is not empty.

Back up the database first...

|improve this answer|||||

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.