Support » Fixing WordPress » Trigger when a block is duplicated

  • htmgarcia

    (@htmgarcia)


    Hi,
    Gutenberg editor question. When a block is duplicated, is there a trigger that allows me to modify the copied instance of the block such as the attributes?

    I appreciate any advice!

    • This topic was modified 5 months ago by htmgarcia.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @htmgarcia

    Are you talking about when you are editing blocks in the block editor, or duplicating a block some other way.

    When you duplicate a block in the block editor, you can manually edit block content/attributes, so I’m wondering if there is some other way you are duplicating the block?

    Thread Starter htmgarcia

    (@htmgarcia)

    Hi @psykro,
    when a block is duplicated through the editor, I wonder if there is a way to modify the attributes of the copy on the fly? As example: set the value for an attribute as empty ”

    Aha I see what you mean. It may be possible programmatically, by hooking into the JavaScript event that duplicates the block, but one would have to customise it on a per block level.

    However, diving into that topic would be outside of the scope of this support forum.

    @htmgarcia any luck? Could you find a way?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.