|
@@ -1,12 +1,6 @@
|
|
wp.domReady(() => {
|
|
wp.domReady(() => {
|
|
|
|
+ // Remove specific non-embed blocks
|
|
const removeBlocks = [
|
|
const removeBlocks = [
|
|
- // Remove specific embeds
|
|
|
|
- 'core/embed-facebook',
|
|
|
|
- 'core/embed-instagram',
|
|
|
|
- 'core/embed-scribd',
|
|
|
|
- 'core/embed-tiktok',
|
|
|
|
- 'core/embed-twitter',
|
|
|
|
- // Remove some core blocks
|
|
|
|
'core/verse',
|
|
'core/verse',
|
|
'core/freeform',
|
|
'core/freeform',
|
|
'core/archives',
|
|
'core/archives',
|
|
@@ -14,12 +8,20 @@ wp.domReady(() => {
|
|
'core/tag-cloud',
|
|
'core/tag-cloud',
|
|
'core/rss',
|
|
'core/rss',
|
|
'core/latest-comments',
|
|
'core/latest-comments',
|
|
- 'core/social-links'
|
|
|
|
|
|
+ 'core/social-links',
|
|
|
|
+ 'core/tags',
|
|
|
|
+ 'core/comments',
|
|
|
|
+ 'core/post-comments-form'
|
|
];
|
|
];
|
|
|
|
|
|
|
|
+ // Log available blocks for debugging
|
|
|
|
+ console.log('Available blocks:', wp.blocks.getBlockTypes().map(block => block.name));
|
|
|
|
+
|
|
|
|
+ // Remove specified core blocks
|
|
removeBlocks.forEach(blockName => {
|
|
removeBlocks.forEach(blockName => {
|
|
try {
|
|
try {
|
|
- if (wp.blocks.getBlockType(blockName)) {
|
|
|
|
|
|
+ const block = wp.blocks.getBlockType(blockName);
|
|
|
|
+ if (block) {
|
|
wp.blocks.unregisterBlockType(blockName);
|
|
wp.blocks.unregisterBlockType(blockName);
|
|
console.log(`Successfully removed block: ${blockName}`);
|
|
console.log(`Successfully removed block: ${blockName}`);
|
|
}
|
|
}
|
|
@@ -27,4 +29,47 @@ wp.domReady(() => {
|
|
console.warn(`Failed to remove block ${blockName}:`, error);
|
|
console.warn(`Failed to remove block ${blockName}:`, error);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ // Only remove specific embed variations
|
|
|
|
+ const removeEmbeds = [
|
|
|
|
+ 'facebook',
|
|
|
|
+ 'instagram',
|
|
|
|
+ 'scribd',
|
|
|
|
+ 'tiktok',
|
|
|
|
+ 'twitter',
|
|
|
|
+ 'tumblr',
|
|
|
|
+ 'reddit',
|
|
|
|
+ 'pinterest',
|
|
|
|
+ 'smugmug',
|
|
|
|
+ 'crowdsignal',
|
|
|
|
+ 'kickstarter',
|
|
|
|
+ 'mixcloud',
|
|
|
|
+ 'spotify',
|
|
|
|
+ 'soundcloud',
|
|
|
|
+ 'bandcamp',
|
|
|
|
+ 'flickr',
|
|
|
|
+ 'wordpress',
|
|
|
|
+ 'dailymotion',
|
|
|
|
+ 'imgur',
|
|
|
|
+ 'issuu',
|
|
|
|
+ 'wolfram',
|
|
|
|
+ 'reverbnation',
|
|
|
|
+ 'cloudup',
|
|
|
|
+ 'animoto',
|
|
|
|
+ 'ted',
|
|
|
|
+ 'bluesky',
|
|
|
|
+ 'pocket',
|
|
|
|
+ 'speaker-deck',
|
|
|
|
+ 'videopress',
|
|
|
|
+ 'pocket-casts',
|
|
|
|
+ 'amazon-kindle',
|
|
|
|
+ 'wolfram-cloud',
|
|
|
|
+ 'wordpress-tv'
|
|
|
|
+ ];
|
|
|
|
+ wp.blocks.getBlockVariations('core/embed')?.forEach(variation => {
|
|
|
|
+ if (removeEmbeds.includes(variation.name)) {
|
|
|
|
+ wp.blocks.unregisterBlockVariation('core/embed', variation.name);
|
|
|
|
+ console.log(`Removed embed variation: ${variation.name}`);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|