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

Uncaught TypeError: wp.apiFetch is not a function

as @Alvero pointed out in the comments, instead of just supplying wp-api in the block registration, you now need to specify wp-api-fetch. $index_js=”sample-post/index.js”; wp_register_script( ‘sample-post-block-block-editor’, plugins_url( $index_js, __FILE__ ), array( ‘wp-blocks’, ‘wp-i18n’, ‘wp-element’, ‘wp-api-fetch’, ), filemtime( “$dir/$index_js” ) ); Then within your block, you call it using the wp.apiFetch function: var registerBlockType = wp.blocks.registerBlockType, el … Read more

Enhancing Gutenberg featured image control

I’ve got JavaScript that verifiably loads on the post type edit page But did you enqueue your script with the correct dependencies? Have you checked the browser console? Did it say something like “Uncaught TypeError: Cannot read property ‘createElement’ of undefined“? The JavaScript code in the question requires the @wordpress/element and @wordpress/hooks packages, which are … Read more

Find all the places where a block type is used

I know that this is not welcome here, but my only answer is that I can refer you to the following plugin. The plugin was released a few weeks ago and finds exactly the blocks used for your installation. Exactly what you need. https://wordpress.org/plugins/find-my-blocks/

How to use “getEntityRecords” for user data?

So I guess you’re still using WordPress version 5.3.x? 🙂 Because if so (and I was), then yes, the users endpoint (at wp/v2/users) is not included in the default entities. But you can manually add it: // Add the endpoint. wp.data.dispatch( ‘core’ ).addEntities( [ { name: ‘user’, kind: ‘root’, baseURL: ‘/wp/v2/users’ } ] ); And … Read more

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