- fix block restrictions 3rd party plugin

This commit is contained in:
ashubawork
2025-07-30 10:07:01 +03:00
parent a50ab63067
commit 824c95e414
+13
View File
@@ -9,6 +9,19 @@ function um_admin_blocks_custom_fields( um_condition_fields, props ) {
return wp.hooks.applyFilters( 'um_admin_blocks_custom_fields', [], um_condition_fields, props );
}
function um_add_restriction_attributes( settings, name ) {
// Some blocks have a strict attribute scheme.
// They reject any attributes that were not originally defined in them.
// When the editor tries to render such a block, the server sees an unfamiliar
// attribute um_is_restrict and returns a 400 error, prohibiting "foreign" properties.
const excludedPrefixes = [
'llms/'
];
// Check the blocklist of prefixes.
if ( excludedPrefixes.some( prefix => name.startsWith( prefix ) ) ) {
return settings;
}
// add attributes for all blocks
const restrictionAttributes = {
um_is_restrict: {