AdvancedCustomFields / AdvancedCustomFields/acf

manually duplicate serialized block

Open
#386 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

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"
} /-->

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue only provides serialized wp:acf/files block examples and does not name repository files or tests. Start by reproducing the two-block content in WordPress with ACF, then inspect the block serialization and rendering behavior. Done means documenting whether manually changing the block ID is supported and identifying any required related values.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
content
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.