ACF attachment custom field in rest response

Check out ACF to REST API – https://github.com/airesvsg/acf-to-rest-api You can optionally turn on/off which fields you want to enable. // Enable the option show in rest add_filter( ‘acf/rest_api/field_settings/show_in_rest’, ‘__return_true’ ); // Enable the option edit in rest add_filter( ‘acf/rest_api/field_settings/edit_in_rest’, ‘__return_true’ );

Make a list with header and subtext in Gutenberg blocks

In general you have to do those things: Define you attributes Write a UI for the editor in the edit function, which saves values entered by the editor to your attributes Render the html with the save function by using the values from your attributes The tutorial from the official docs isn’t half bad: https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type/

srcset attribute in Gutenberg gallery blocks

Unfortunately, setting the sizes based on the viewpoint size in the Gallery Block isn’t possible as of this writing (quite frustrating, imho) :/ There’s a couple outstanding tickets about this, notably: https://github.com/WordPress/gutenberg/issues/9620 and https://github.com/WordPress/gutenberg/issues/13842

Load script after block is inserted

I ended up putting an empty svg in an img tag with an onload event. This is probably not ideal, but it does work. <img // onload hack fires when block is added className=”onload-hack-pp” height=”0″ width=”0″ onLoad={ onBlockLoad } src=”data:image/svg+xml,%3Csvg xmlns=”http://www.w3.org/2000/svg” viewBox=’0 0 1 1′ %3E%3Cpath d=”/%3E%3C/svg%3E” />

Gutenberg remove Most Used group

Add CSS to wp-admin: functions.php: function admin_scripts() { wp_enqueue_style(‘admin-edits’, get_stylesheet_directory_uri() . ‘/assets/css/admin.css’); } add_action(‘admin_enqueue_scripts’, ‘admin_scripts’); admin.css: #block-editor-inserter__search-1:placeholder-shown + .editor-inserter__results .components-panel__body:first-of-type { display: none; }

How to use wp.hooks.addAction() in React JS/Gutenberg?

How to use wp.hooks.addAction? It’s basically like so, just like you’ve attempted: // Hook to the hook_name action. wp.hooks.addAction( ‘hook_name’, ‘namespace’, function(){ console.log( ‘Foo Bar’ ); } ); // Trigger the hook_name action. wp.hooks.doAction( ‘hook_name’ ); Or for hooks which provides one or more parameters to the callback: // Hook to the hook_name action. wp.hooks.addAction( … Read more