2

I'm working with Matrix field. When adding and then removing and then adding again fields with the same handle I get the following error.

Handle "videoUrl" has already been taken.

Is there a way of removing old handles that are not being used?

This is actually creating issues adding new fields with a different handle too. Even though a new handle is being used an old handle is being referenced as a blocker to adding a new field. I get the following error when trying to save a post.

Invalid field handle: embed

'Embed' isn't even listed in the field manager area as a field handle but the problem persists.

2 Answers 2

1

Tried it here and seems ok. Once you have deleted your field, are you saving your matrix block (top right button)?

If you delete the field then try to recreate it straight away (or any other field for that matter), it gives you the Handle "videoUrl" has already been taken. until you save the block. Once you save, you should be ok to recreate.

It does seem a bit buggy though as you need to save in between each action... Might need to see what the craft guys think.

6
  • Embed isn't even listed in the admin area as a field handle - but is still treated as one.
    – Dan Lee
    Commented Feb 19, 2019 at 11:15
  • Did you leave the page without saving at some point? This might have created the problem. Do you see the field in the Db?
    – Oli
    Commented Feb 19, 2019 at 11:23
  • Very possible - I'm taking a look now in the DB.
    – Dan Lee
    Commented Feb 19, 2019 at 11:25
  • I have tried deleting a field from a block in the Db just now and it doesn't seem to cause problem so you should be safe to do that. Back up before in case... :)
    – Oli
    Commented Feb 19, 2019 at 11:26
  • Yes it is still there
    – Dan Lee
    Commented Feb 19, 2019 at 11:27
0

So I used the following to find unused fields in the database. Then I manually removed them. Please backup before doing this!

SELECT f.* FROM fields f LEFT JOIN fieldlayoutfields l ON l.fieldId = f.id WHERE l.id IS NULL

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.