Why does the custom HTML block not preserve the HTML characters?

This is caused by wptexturize and the use of a standard <div> to contain your code. See https://developer.wordpress.org/reference/functions/wptexturize/ Instead, markup code as code: Text enclosed in the tags <pre>, <code>, <kbd>, <style>, <script>, and <tt> will be skipped. This list of tags can be changed with the no_texturize_tags filter. Note that the HTML block just … Read more

Align a custom block button by wrapping it in div

If you turned on script debugging or the SCRIPT_DEBUG constant in WordPress, then you would’ve noticed that your block type causes React to throw this warning: “Warning: React does not recognize the tagName prop on a DOM element.“, so when developing block types, you should enable script debugging — at least, you’ll know your code … Read more

WP Blocks – Gutenberg – not rendering $content

ServerSideRender uses the Block Renderer API endpoint (/wp/v2/block-renderer/<name>) which does not parse inner blocks, hence the $content in your block render callback would naturally be empty. However, retrieving the inner blocks is pretty easy and as you’ve thought, you can set the blocks (or their content) as an attribute that you would pass to ServerSideRender. … Read more

Redirect to “All Posts” after post update or publish in Block Editor

As far as I can see, the function redirect_post, where the redirect_post_location filter resides, is not automatically called anywhere, so that filter won’t be triggered. The save_post hook (or preferably save_post_post_type) still works, but not with metaboxes, as Gutenberg saves these separately using ajax calls. Ajax calls run in the background and do not affect … Read more