Blocks/Gutenberg Editor Bug: Variables as integers in php code cause 500 error
-
I currently have
wp_list_pagesas a post snippet that’s a shortcode that runs as PHP code withpost_type=page,depth=0,child_of=0as the variables.The post snippet code then consists of:
echo '<ul class="wp-list-pages">'; wp_list_pages(array( 'post_type' => '{post_type}', 'depth' => {depth}, 'title_li' => '', 'child_of' => {child_of}, )); echo '</ul>';Using
[wp_list_pages post_type="page" child_of="26" depth="-1"]as a shortcode works perfectly fine.However, selecting this post snippet via the block in the Blocks/Gutenberg editor (which then doesn’t have its variables work per https://ww.wp.xz.cn/support/topic/blocks-gutenberg-editor-bug-cant-fill-out-variables-for-post-snippets/) and then saving the page has the editor then return a 500 server error (it does a full 500 server error upon editor refresh.)
Commenting out
'depth' => {depth},and'child_of' => {child_of},from the post snippet made the editor not return a fatal error anymore.It appears that something when it comes to the parsing (and potential preview behind the scenes?) of post snippets with its current Blocks editor implementation is going wrong. There should be no issue with the post snippet code & it rightly works as expected when called as a shortcode instead of using the current post snippets block in the Blocks editor.
I’d really like to get this working with the Blocks editor as it is a nicer experience and should be the future of WordPress as the default editor that’s only becoming more capable & widely used over time.
Thanks for your time,
Kurt
The topic ‘Blocks/Gutenberg Editor Bug: Variables as integers in php code cause 500 error’ is closed to new replies.