Remove environment-specific attributes from block markup
Currently, an exported theme includes attributes such as ref and id for certain blocks, but these have no context outside of the environment where the theme was built. They can also break some blocks (a ref in a nav block that doesn't exist on a different WordPress instance will currently cause the nav block to break).
Here are the cases I can think of, but there may be more:
- [ ] Remove
refattributes from the Navigation block - [ ] Remove
idattributes from Image and Cover blocks - [ ] Remove
wp-image-[id]classes from Image and Cover blocks - [ ] Remove
categoryIDs from query blocks - [ ] Remove
taxQueryattribute from query blocks - [x] ~Remove
queryIdattributes from Query block~ I don't think this needs removing, see https://github.com/WordPress/gutenberg/issues/42730#issuecomment-1428524380 for more details.
I think this could be a gutenberg PR, since this plugin is already using the export functions, it makes sense that what gets exported is usable outside of the context where it was exported from. Do you agree @scruffian ?
I agree!
Makes sense! I'll replicate the issue over there.
Already exists 😁 https://github.com/WordPress/gutenberg/issues/42730