I want to add checkbox to core/embed, I ahave tried many solutions , non work for example , one of my essays Update : addng any field would be appreciated
wp.hooks.addFilter(
'blocks.registerBlockType', // The filter hook to modify block registration
'misha/oembed', // A unique name for this modification
(settings, name) => {
// Check if the block name is 'core/embed'
if ('core/embed' === name) {
// Add custom 'custom_text_field' attribute
return lodash.assign({}, settings, {
attributes: lodash.assign({}, settings.attributes, {
custom_text_field: {
type: 'string', // Type of the attribute (string)
default: '', // Default value for the text field (empty string)
}
})
});
}
// Return the settings unmodified if it's not 'core/embed'
return settings;
}
);
I have found this code maybe useful
function addCustomAttributes( settings, name ) {
if ( settings.attributes ) {
settings.attributes.customAttribute = {
type: 'string',
default: ''
};
settings.attributes.anotherCustomAttribute = {
type: 'boolean',
default: false
};
}
return settings;
}