Using wp.data.select get actual tags (not id’s) used in post

You can use getEntityRecord() like so: const tag_ids = wp.data.select( ‘core/editor’ ).getEditedPostAttribute( ‘tags’ ); // the last parameter is always the tag ID (and just one single ID) const tag = wp.data.select( ‘core’ ).getEntityRecord( ‘taxonomy’, ‘post_tag’, tag_ids[0] ); console.log( tag ? tag.name : ‘still resolving or no such tag..’ ); Or use getEntityRecords() with the … Read more

Can’t select my block by clicking on it

When using apiVersion: 2 you must use the new useBlockProps hook to implement standard block behavior for your custom block. In your case you would “tell” the editor to treat your <img> as a block wrapper. This needs to be implemented in Edit and in Save and is explained here in detail: https://make.wordpress.org/core/2020/11/18/block-api-version-2/ Alternatively you … Read more

Disable title block on edit screen for a custom post type

I initially didn’t believe this is possible officially at the moment, the post title is always included: https://github.com/WordPress/gutenberg/blob/a6a0d3d47d24b83a58db7130fa82133428067326/packages/edit-post/src/components/visual-editor/index.js#L77 <div className=”edit-post-visual-editor__post-title-wrapper”> <PostTitle /> </div> The only exception at the moment is if a block template is being edited. In particular, this isn’t a block. There is a post title block but it’s only used in full … Read more

Dynamic Gutenburg block output echoes in WP Dashboard

Excerpt from “Creating dynamic blocks” in the block editor handbook: The server-side rendering is a function taking the block and the block inner content as arguments, and returning the markup (quite similar to shortcodes) So despite the “render” as in render_callback, a block render callback should not actually echo anything (and neither call any functions … Read more

ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set

the issue I’m having is that the image data object (imgDataObj in the js), which is saved as an attribute in the JS side, is getting passed to the PHP side even though I’m not passing it in the serversiderender component and I’m not listening for it in the PHP render callback That issue could … Read more