• Resolved paulpunch

    (@paulpunch)


    Hi, i have some standard content from an old wordpress instance that im wanting to import into a gutenberg block that is set every time a post is created.

    In this import to try this i did the following:

    <!– wp:acf/single-post-content –>
    “id”: “block_6063172cec730”,
    “name”: “acf\/single-post-content”,
    “data”: “is_featured_post”: “1”,
    “_is_featured_post”: “field_5f578cc6cf7ba”,
    “post_content”: “tester”,
    “_post_content”: “field_5f578c782976d”
    “mode”: “edit”
    <!– /wp:acf/single-post-content –>

    This works and actually adds to block but because the “data”: isnt like this {} its not working, however when i add the {} it doesnt pass the data in, it does without but obviously doesnt work to see it

    Have you done anything like this before?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter paulpunch

    (@paulpunch)

    just noticed this is not really possible as every time the block is created auto it generates an ID so the id im targeting is never the right one. Will find another way sorry

    Plugin Author WP All Import

    (@wpallimport)

    Hey @paulpunch,

    I’m not sure if the ID will cause an issue or not (might be a good question for the ACF support team), but I wanted to let you know that you can import the curly braces by escaping them with backslashes. For example:

    <!-- wp:acf/testimonial \{
        "id": "block_6064d8eb80c24",
        "name": "acf\/testimonial",
        "data": \{
            "testimonial": "{testimonial[1]}",
            "_testimonial": "field_6064d807d1041",
            "author": "{author[1]}",
            "_author": "field_6064d72b79dc0",
            "role": "{role[1]}",
            "_role": "field_6064d73579dc1",
            "background_color": "#c9c9c9",
            "_background_color": "field_6064d848d1043",
            "text_color": "#707070",
            "_text_color": "field_6064d84fd1044"
        \},
        "align": "",
        "mode": "preview"
    \} /-->
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Import into gutenberg data block’ is closed to new replies.