Gutenberg: How to use output of php render_callback function in the block editors backend?

I think that you are missing the PHP registration of the block. The JS definition is all right, but you need to tell PHP that the block exists. Can you try to register your block in your plugin or function.php file? Here is an example https://developer.wordpress.org/block-editor/tutorials/block-tutorial/creating-dynamic-blocks/ <?php function simpletoc_toc_render_callback( $attributes, $content ) { return ‘This … Read more

WP 5.8 “Query Loop” block: where to place custom query?

Looking into render_block_core_post_template() we can see it calls build_query_vars_from_query_block() (previously named construct_wp_query_args) to setup the query arguments of WP_Query from the Query` block properties. From there I don’t see it supporting custom taxonomies for the secondary query … yet! Work-around-idea: For the Query Loop: add a search keyword for using custom taxonomies, e.g. :query-motor-electric: and … Read more

get selected categories or tags (using javascript) in GutenBerg?

To get the categories from inside the editor of a post you can make use of the following selectors: The categories the post has in the published version: wp.data.select(“core/editor”).getCurrentPostAttribute(“categories”) The current categories of the edit (for example if the user has selected a new category but hasn’t saved the post it will appear with this … Read more

Dynamic gutenberg block with react instead of php

Gutenberg is not intended to do dynamic React stuff in front-end. Nevertheless there is a way to bypass this problem: I assume the structure of gutenberg block when using npm init @wordpress/block my-block to init your block. You have to register your own client-side script in my-block.php to be executed on front-end; one drawback: it … Read more

Serialize custom block with InnerBlock

What you asked for is not possible for blocks that rely on frontend javascript, this includes embeds. It’s also not possible using the Swiper react library. The Swiper library made the questionable choice of manually inspecting child components for the SwiperSlide component name, preventing it from ever being used with child blocks. Edit: Actually maybe … Read more