Hello, I have a problem with $block['data'] in Gutenberg.
I use Sage 10 and WP 5.8.
When I want to insert a block in preview mode it is not loaded and I get in the console the message: POST https://xxxxx.test/wp/wp-admin/admin-ajax.php 500. After some time Gutenberg shows something about JSON error and the page crashes after a reload.
But if you switch to edit mode, everything works without problems. After saving the page you can also switch to preview mode without problems.
This fits so far, but in Gutenberg it looks like this only after inserting it via edit mode after you have saved the page.
The first time you insert it in preview mode $block['data'] looks like this:
data:
_lme__headline: "field_611bc02742f5e"
If you use this in the template, there are no problems at all:
<h2>{{ get_field('lme__headline') }}</h2>--}}
Why is lme__headline: "Latest Magazine Entries" initial missing in $block['data'] in Gutenberg?
Maybe you have a solution for this problem, otherwise I have to switch to get_field everywhere instead of $block['data']['xyz'].
Hello, I have a problem with $block['data'] in Gutenberg.
I use Sage 10 and WP 5.8.
When I want to insert a block in preview mode it is not loaded and I get in the console the message: POST https://xxxxx.test/wp/wp-admin/admin-ajax.php 500. After some time Gutenberg shows something about JSON error and the page crashes after a reload. But if you switch to edit mode, everything works without problems. After saving the page you can also switch to preview mode without problems.
Here is an excerpt from the block template:
If you output $block['data'] via console.log() for example on the web page, you get:
This fits so far, but in Gutenberg it looks like this only after inserting it via edit mode after you have saved the page. The first time you insert it in preview mode $block['data'] looks like this:
If you use this in the template, there are no problems at all:
<h2>{{ get_field('lme__headline') }}</h2>--}}
Why is
lme__headline: "Latest Magazine Entries"
initial missing in $block['data'] in Gutenberg?Maybe you have a solution for this problem, otherwise I have to switch to get_field everywhere instead of $block['data']['xyz'].