Custom block SelectControl works but equivalent ComboboxControl gives errors – where’s my mistake?

This took me a while to figure out… It’s a bug. The JavaScript error occurs because the onFilterValueChange function is not defined… Even though the WordPress documentation says this function is optional. Simply adding onFilterValueChange with an anonymous function removes the JavaScript error. E.g. <ComboboxControl label=”Font Size” value=”small” options={[ { value: “small”, label: “Small” }, … Read more

Converting a WordPress widget to a block

The short answer here is no. Widgets are written in PHP and blocks are written in JavaScript. Beyond that there pretty fundamental differences between the two paradigms in the sense of where they are stored, markup output approaches etc. You could take the approach of a dynamic block where the block is rendered on the … Read more

Classic editor showing in Gutenberg when creating a custom post type

Yep, you just need to add ‘show_in_rest’ => true Here’s the full snippet: // Register Custom Post Type function custom_post_type() { $labels = array( ‘name’ => _x( ‘Post Types’, ‘Post Type General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Post Type’, ‘Post Type Singular Name’, ‘text_domain’ ), ‘menu_name’ => __( ‘Post Types’, ‘text_domain’ ), ‘name_admin_bar’ => … Read more