Skip to content
All gists
Back to GitHub
Sign in
Sign up
Sign in
Sign up
{{ message }}
Instantly share code, notes, and snippets.
tommcfarlin
/
remove-tinymce-editor-buttons.php
Secret
Last active
Jul 22, 2017
Star
4
Fork
0
Star
Code
Revisions
2
Stars
4
Embed
What would you like to do?
Embed
Embed this gist in your website.
Share
Copy sharable link for this gist.
Clone via HTTPS
Clone with Git or checkout with SVN using the repository’s web address.
Learn more about clone URLs
Download ZIP
[WordPress] Remove buttons from the TinyMCE editor
Raw
remove-tinymce-editor-buttons.php
<?php
add_filter
(
'mce_buttons_2'
,
'acme_remove_firm_kitchen_sink'
);
/**
* Removes the all but the formatting button from the post editor.
*
* @since 1.0.0
*
* @param array $buttons The current array buttons including the kitchen sink.
* @return array The updated array of buttons that exludes the kitchen sink.
*/
function
acme_remove_firm_kitchen_sink
(
$
buttons
) {
$
invalid_buttons
=
array
(
'underline'
,
'justifyfull'
,
'forecolor'
,
'|'
,
'pastetext'
,
'pasteword'
,
'removeformat'
,
'charmap'
,
'outdent'
,
'indent'
,
'undo'
,
'redo'
,
'wp_help'
);
foreach
(
$
buttons
as
$
button_key
=>
$
button_value
) {
if
(
in_array
(
$
button_value
,
$
invalid_buttons
) ) {
unset(
$
buttons
[
$
button_key
] );
}
}
return
$
buttons
;
}
Sign up for free
to join this conversation on GitHub
. Already have an account?
Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.