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

Multiple checkboxes Gutenberg control

Use this code $.each(data, function (c, fields) { checkboxes.push( el( CheckboxControl, { key: fields.value, label: fields.label, name: ‘myCheckbox[]’, checked: props.attributes.myCheckbox.indexOf(fields.value) > -1, onChange: function( val ) { let data = props.attributes.myCheckbox; if (val) { if (data.indexOf(fields.value) === -1) { data.push(fields.value); } } else { data = props.attributes.myCheckbox.filter((v) => v !== fields.value); } props.setAttributes({ myCheckbox: data … Read more

How To Apply Different Styles To All Blocks Based on Post Meta Value?

I was able to solve this problem by using the admin_body_class filter to add a class name to the <body> element of the admin page, and writing selectors for that class in my stylesheet. add_filter( ‘admin_body_class’, ‘add_status_classes’ ); function add_status_classes( $classes ) { $post_meta = get_post_meta( get_the_ID() ); $is_darkmode = $post_meta[‘_is_post_dark_mode’]; if ( $is_darkmode ) … Read more