Skip to content

manually duplicate serialized block #386

Open
@pwkip

Description

@pwkip

Maybe not so much an issue, but just something I'm wondering about.

Say, I have a block like this:

<!-- wp:acf/files {
    "id":"block_5f5f66a404b23",
    "name":"acf/files",
    "data": { 
        "files_0_file":8460,
        "_files_0_file":"field_5f3e4591bd4e6",
        "files_0_filename":"My first file",
        "_files_0_filename":"field_5f46b891c44ef",
        "files_1_file":920,"_files_1_file":"field_5f3e4591bd4e6",
        "files_1_filename":"My second file",
        "_files_1_filename":"field_5f46b891c44ef",
        "files":2,"_files":"field_5f3e4578bd4e5"
    },
    "mode":"edit"
} /-->

But I would like to duplicate it manually, so my HTML code will look like this:

<!-- wp:acf/files {
    "id":"block_5f5f66a404b23",
    "name":"acf/files",
    "data": { 
        ...
    },
    "mode":"edit"
} /-->
<!-- wp:acf/files {
    "id":"block_5f5f66a404b23",
    "name":"acf/files",
    "data": { 
        ...
    },
    "mode":"edit"
} /-->

Now I end up with 2 blocks with the same ID. If I make changes to the second block, they are not reflected on the front-end, I guess because the 2 blocks share the same ID. So if I wanted to duplicate a block like this, can I just update the ID with anything I like (as long as I know it is unique)?

So for example: will this work, without any additional complications?

<!-- wp:acf/files {
    "id":"block_5f5f66a404b23",
    "name":"acf/files",
    "data": { 
        ...
    },
    "mode":"edit"
} /-->
<!-- wp:acf/files {
    "id":"block_my_own_unique_id",
    "name":"acf/files",
    "data": { 
        ...
    },
    "mode":"edit"
} /-->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions