Problems with the PluginDocumentSettingPanel SlotFill in Gutenberg

It doesn’t work because that is old behaviour and Gutenberg changed a year ago. Where The Confusion Comes From This commit: https://github.com/WordPress/gutenberg/commit/00cb38c3655daffd429ad4acfc57d6ee3b7f2d83 On Apr 20, 2022 code was removed that made it fallback to the plugin icon. Now an icon has to be explicitly passed as a prop or no icon is shown. Why? https://github.com/WordPress/gutenberg/pull/40355 … Read more

Conditional concerning a selected tag not working

isset() checks to see if a variable is set, ie, has a value other than null. The way you’re using it will always return true because you’ve set $posttags to ‘animali permessi’, which is not null. I think you’re looking for the WordPress function has_tag() instead. if (has_tag( ‘animali permessi’, $post ) ) { $supplemento_animali … Read more

disable the post title field after publishing

Use the action hook edit_form_after_title The display:none rule might cause some JS issue so it might be best to use visibility:hidden so the element is still accessible to whatever scripts in the DOM. This condition will hide the form fields and show the title and URL statically. add_action(‘edit_form_after_title’, function($post) { if( !empty($post->post_title) && !current_user_can(‘manage_options’) ) … Read more

Using backbone, can I prevent the nonce from being set?

Yes, the nonce is by default always being sent via the X-WP-Nonce header – see the source here and here on GitHub. wp.api.WPApiBaseModel.prototype.sync and wp.api.WPApiBaseCollection.prototype.sync can technically be extended or modified, but I would instead disable the nonce header like so, i.e. using <Collection or Model object>.endpointModel: Collection example: const Posts = new wp.api.collections.Posts(); // … Read more

How to use get_option() in Gutenberg block editor to retrieve global settings?

If your option is enabled in the REST API, e.g. by using register_setting() with ‘show_in_rest’ => true, you can use wp.data.select( ‘core’ ).getSite() to retrieve the value of your option, and to update the option, you can use wp.data.dispatch( ‘core’ ).saveSite(). So for example in your case: To get the option value: wp.data.select( ‘core’ ).getSite()?.autoupdate … Read more