• Not linking because this is an easily reproducible error that requires multiple changes to demonstrate. this is a 5 min setup on a local dev site.

    Error

    When using an elementor block inside of a post. The rest API no longer shows ACF fields, simply returns an empty array.

    Proof of conflict

    Remove the block from the post, the ACF fields show correctly in the API. Uninstall the plugin, all ACF fields show in the API.

    Must haves to test:

    1. plugin slugs active: elementor, block-builder, advanced-custom-fields
    2. an elementor template
    3. post with elementor template added via block-builder block
    4. ACF field group with information in an acf field filled out, and field group has “show in rest API” turned on.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @m8hue, can you elaborate a little bit more about the #4th step? (the ‘ACF field group with information in an ACF field filled out, and field group has “show in rest API” turned on’ step)
    We are trying to reproduce the issue, but we might have misunderstood this step, so if you can break it down to more detailed steps, that would help us a lot 🙏


    Thread Starter m8hue

    (@m8hue)

    Sure,

    Open up the ACF field group, scroll down to settings and open the tab ‘Group Settings’. There’s a toggle for ‘show in rest api’.

    That adds the acf fields for the group to a post in the rest api under ‘acf: [array]’ per post when those ACF fields are filled out for the post.

    With that setting active,

    1. open a post, fill out an acf field, and publish. Check the /wp-json/wp/v2/post/[$post->ID] for that post to see the acf value.
    2. edit the post to include an elementor block from the plugin. & publish.
    3. Recheck the link above to see the post is no longer showing ACF Fields in rest.

    I did find a single boolean that does seem to be the source of the issue tracing through the function calls.

    https://github.com/elementor/block-builder/blob/master/blocks/template-block.php

            return Plugin::elementor()->frontend->get_builder_content( $attributes['selectedTemplate'], true );

    Line 122, if the boolean is switched to false, the rest api appears as it should. But looking into the ramifications of that is past what i’ve done on followup.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Elementor blocks breaks ACF rest API’ is closed to new replies.