Editing broken with plugin activated
phtmgt opened this issue · 9 comments
Blank (white) page on post edit.
Wordpress 5.7.2
@plamenh How did you install the plugin? Did you run composer install?
Can you download a built version of the plugin here.
@plamenh Do you use Yoast? We've noticed, that adding blocks to the REST API results in a blank page (JavaScript errors which leads to Gutenberg/React not rendering) as long as Yoast is enabled.
We first tried adding blocks to the API via a simple custom plugin and then tried this plugin. It didn't make any difference.
We boilt it down to the return value of the get_callback
function. Just returning an empty array works. Returning the result of parse_blocks
doesn't work. However, the result doesn't change depending on if Yoast is enabled or not.
register_rest_field($post_type, 'blocks', [
'get_callback' => function(array $post) {
$array = parse_blocks($post['content']['raw']);
return $array; // Doesn't work
// return array(); // Works
}
]);
UPDATE: It seems to be working fine if you don't use blocks
as name for the new API property
As a matter of fact, yes, we do use yoast. I guess we will just disable it, seems like the most straightforward fix. Thanks.
@simonknittel So the issue is related to yoast being installed?
@simonknittel So the issue is related to yoast being installed?
I guess so. Two workarounds I found:
- Disable Yoast
- Use some other property name than
blocks
I believe that #18 might this fix. Watch this space.
@plamenh @simonknittel Can you install version 0.3.0 and see if this is still an issue?
@spacedmonkey I can confirm 0.3.1 works fine with Yoast SEO turned on. Thanks.
Yep I had issue with Yoast too, but when both plugins are up to date, all is fine.