Restricting core block nested blocks

For anyone looking for something similar I came across this in a PR – https://github.com/WordPress/gutenberg/pull/31326#pullrequestreview-781388981 This filter setup has worked for any block that I’ve tried that has allowedBlocks set as an array in the block.json file.

Create a block variation of list elements

Since I am working with block attributes, I had to also define my attribute within my block.json file… block.json “attributes”: { “listOrdered”: { “type”: “boolean”, “default”: false } Now with that set in place, I can now run npm start, and see my block variant working well in wp-admin edit page. It allows me a … Read more

How to disable block directory?

Yes, it is possible. Excerpt from Editor Hooks → Block Directory in the block editor handbook: The Block Directory enables installing new block plugins from WordPress.org. It can be disabled by removing the actions that enqueue it. In WordPress core, the function is wp_enqueue_editor_block_directory_assets. To remove the feature, use remove_action, like this: <?php // my-plugin.php … Read more

Localising a Block

There are 2 main issues in your code: As stated in my answer, the script handle format is <block name with slashes replaced with hypens>-editor-script, so because your block name is my-block/local, then the script handle is my-block-local-editor-script and not my-block-local-edit-script. The correct action name is wp_enqueue_scripts (note the “s”) and not wp_enqueue_script. However, wp_enqueue_scripts … Read more

What is the standard way to use the version of React that ships with Gutenberg on the front end?

I found it, wp-element. The @wordpress/scripts should handle the heavy lifting of transforming the JSX in the proper way. add_action( ‘wp_enqueue_scripts’, ‘my_enqueue_plugin_js’ ); // Loads on frontend function my_enqueue_plugin_js() { wp_enqueue_script( ‘my-plugin-frontend’, plugin_dir_url( __FILE__ ) . ‘js/plugin.js’, [‘wp-element’] ); } Once we do this we will have window.wp.element available in our JavaScript. This contains the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)