Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai-mu-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noblogs
ai-mu-plugins
Commits
f7cdc5ea
Commit
f7cdc5ea
authored
2 years ago
by
agata
Browse files
Options
Downloads
Patches
Plain Diff
Revert "add ai-blocks.php"
This reverts commit
8e24c77d
.
parent
8e24c77d
Branches
Branches containing commit
Tags
v0.4.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ai-blocks.php
+0
-40
0 additions, 40 deletions
ai-blocks.php
with
0 additions
and
40 deletions
ai-blocks.php
deleted
100644 → 0
+
0
−
40
View file @
8e24c77d
<?php
/*
* Plugin Name: A/I - Add a denylist of gutenberg blocks
* Plugin URI:
* Description: Remove some block from editor
* Version: 0.0.1
* Author: Autistici/Inventati
* Author URI: https://autistici.org
**/
add_action
(
'setup_theme'
,
'ai_blocks_setup_theme_action'
);
/**
* Function for `setup_theme` action-hook.
*
* @return void
*/
function
ai_blocks_setup_theme_action
(){
/*
* Blacklist specific Gutenberg blocks
*
* @author Misha Rudrastyh
* @link https://rudrastyh.com/gutenberg/remove-default-blocks.html#blacklist-blocks
*/
add_filter
(
'allowed_block_types_all'
,
'blacklist_blocks'
);
function
blacklist_blocks
(
$allowed_blocks
)
{
// get all the registered blocks
$blocks
=
WP_Block_Type_Registry
::
get_instance
()
->
get_all_registered
();
// then disable some of them
unset
(
$blocks
[
'core/embed'
]
);
// return the new list of allowed blocks
return
array_keys
(
$blocks
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment