Preventing double loading JS scripts (like React) when developing for Gutenberg

Any WordPress-packaged scripts enqueued properly via wp_enqueue_script won’t load multiple times. If two different plugins rely on the same dependencies, thanks to the enqueue logic, those dependencies will only be loaded once. create-guten-block only contains javascript relevant to the custom block itself, and sets wp-blocks, wp-i18n, and wp-element (the abstraction layer WP uses on top …

Read more

Relative links in Gutenberg

It doesn’t have anything to do with Gutenberg. It’s just the way WordPress stores links in the main content. Anytime you add a link in the WP editor, it automatically puts in the absolute path. ACF and other forms of custom postmeta instead store the post ID, so whenever its slug/permalink changes they are automatically …

Read more

How Migrate a Legacy Widget to block?

TLDR: If you wanted to update to v5.8 you don’t need to do anything to make widgets work, they won’t break if you update. There is no conversion step, no updating of code to make it work. migration is not necessary. I’m trying to tranform legacy widgets to block, I was reading the docs, but …

Read more

Getting taxonomies associated with a specified post type

Yes, you can pass a post type to getEntityRecords() and also getTaxonomies(), both using the same format which is an object of arguments: Using getEntityRecords(): wp.data.select( ‘core’ ).getEntityRecords( ‘root’, ‘taxonomy’, { type: ‘post’ } ) Using getTaxonomies(): ( which is actually a shorthand for the above code ) wp.data.select( ‘core’ ).getTaxonomies( { type: ‘post’ } …

Read more