block theme FSE – save changes to the theme?

I’ve done a lot of digging into the subject and looks like they were working on some updates to Gutenberg that would allow them to be saved onto the filesystem: youtu.be/8Vj_Oh6jMHw?t=281. But those efforts were later abandoned: github.com/WordPress/gutenberg/pull/40385, as adding that support into WordPress core was complicated. I then found this plugin that lets one … Read more

How to disable blocks in Gutenberg editor for specific post type

Put this in your Theme’s functions.php file. add_filter( ‘allowed_block_types_all’, ‘rt_allowed_block_types’, 25, 2 ); function rt_allowed_block_types( $allowed_blocks, $editor_context ) { if( ‘custom_post_type’ === $editor_context->post->post_type ) { $allowed_blocks = array( ‘core/image’, ‘core/paragraph’, ‘core/heading’, ‘core/list’ ); return $allowed_blocks; } else { return; } } Here’s what it’s doing. The filter allowed_block_types_all is filtering what block types are allowed. … Read more

Have parent block’s isSelected be true if an innerblock is selected?

If you only need to know whether or not an inner-block is selected, you can leverage the core/block-editor store’s hasSelectedInnerBlock() selector. For example, if using a useSelect() hook in a functional component, that might look as such: import { useSelect } from ‘@wordpress/data’; export default function Edit( { isSelected, clientId } ) { const is_inner_block_selected … Read more

FormTokenField passing objects to value property

In short, the “title” which the documentation refers to is a title attribute on the <span> which is rendered for the token, which is to say that the token { value: ‘29654’, title: ‘Post Title’ } will (rhetorically) render as <span title=”Post Title”>29654</span> In order to display “Post Title” as the inner text in the … Read more

Get post ancestors in the Block Editor

August 20, 2022 Update: For completeness, I added a JavaScript/Gutenberg solution which does what the findParent() function in question tries to do, i.e. find the top ancestor. You can find the code below the “Original Answer” section. Original Answer The block editor doesn’t (currently) have a function equivalent to get_post_ancestors(), and yes you could create … Read more

Block validation failed

As Tom pointed out, without the actual code of the block (specifically the save function) it is impossible to tell you exactly what the issue is. That said, if you compare what was generated by the save function and what was in the post body, you’ll see that there is content missing in each of … Read more

Add media dynamically on gutenberg block

You can set the multiple and gallery props to {true} which enables to select multiple images and make a gallery. More information in the GitHub readme: https://github.com/WordPress/gutenberg/tree/master/packages/block-editor/src/components/media-upload

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