Support

Account

Home Forums Gutenberg Change _underscore names to -dash names without loosing content Reply To: Change _underscore names to -dash names without loosing content

  • I can’t tell you how to name blocks, I don’t use them. If it makes more sense to name blocks with a dash than an underscore then I would just use dashes in the future. I don’t see how this would be affected by a field name unless you are dynamically naming your blocks based on the field name.

    Using underscores in really still the best practice for field names. The reason for this is that there are places where arrays are extracted to variables. How often this happens and were I’m not sure. But array indexes with dashes cannot be extracted.

    Quite honestly, not knowing much about blocks, I would say that it has something to do with how WP is parsing the block names when looking at “allowed_block_types_all” You might want to look at this filter: allowed_block_types_all.