How to Fix Missing or Customize Classic Editor Buttons in WordPress
Content
Many WordPress users rely on the Classic Editor and its familiar TinyMCE toolbar. A common issue that arises, especially after WordPress core updates, is that custom buttons disappear or the default toolbar needs to be modified for a specific site's needs. This guide will explain why this happens and provide the most common solutions for managing your Classic Editor buttons.
Why Do Custom Buttons Disappear?
Based on community reports, a frequent cause for missing custom buttons is a change in how scripts are loaded in the WordPress admin area. Custom buttons are typically added using JavaScript's QTags.addButton() function. After updates like WordPress 6.0, the priority at which these scripts run can change. If your custom code runs too early (before the necessary 'quicktags' script is loaded) or too late, the buttons will fail to appear.
Solution 1: Re-add Custom Buttons with Correct Script Priority
The most effective fix for vanished custom buttons is to adjust the priority of the action hook that adds them. The default priority is 10. Decreasing this priority ensures your code runs after the required scripts are ready.
Here is an example of how to properly add a custom button:
function my_custom_quicktags() {
if (wp_script_is('quicktags')){
?>
<script type="text/javascript">
QTags.addButton( 'eg_blue', 'blue', '<span style="color:blue;">', '</span>', '', 'Blue Text', 1 );
</script>
<?php
}
}
// Use a priority higher than 10, like 11 or 99
add_action( 'admin_print_footer_scripts', 'my_custom_quicktags', 11 );
Key takeaway: The priority number in the add_action function is crucial. Experiment with values like 11, 99, or even 999 to find which one works with your specific WordPress environment.
Solution 2: Remove Unwanted Default Buttons
If your goal is to hide or remove default buttons from the toolbar—for instance, to simplify the interface for community bloggers—you can use WordPress filters. The mce_buttons and mce_buttons_2 filters control the first and second rows of buttons, respectively.
The following example code removes the 'bold' and 'italic' buttons from the first row and the 'pastetext' button from the second row.
function customize_editor_buttons( $buttons ) {
// Remove buttons from the first row
$remove = array( 'bold', 'italic' );
$buttons = array_diff( $buttons, $remove );
return $buttons;
}
add_filter( 'mce_buttons', 'customize_editor_buttons' );
function customize_editor_buttons_2( $buttons ) {
// Remove buttons from the second row
$remove = array( 'pastetext' );
$buttons = array_diff( $buttons, $remove );
return $buttons;
}
add_filter( 'mce_buttons_2', 'customize_editor_buttons_2' );
You will need to add this code to your theme's functions.php file or a custom site-specific plugin.
Solution 3: Check for Plugin Conflicts
Sometimes, the toolbar is modified by another plugin. As seen in community threads, plugins from developers like BestWebSoft can add their own elements to the editor. If an unexpected object or button appears, try temporarily disabling your other plugins to see if the issue resolves. If it does, reactivate them one-by-one to identify the culprit. You can then configure that plugin's settings or seek alternatives.
Conclusion
Managing the Classic Editor toolbar is a common task for WordPress site maintainers. Whether you need to restore functionality after an update or tailor the editing experience for your users, the solutions typically involve adjusting script priorities or using built-in filters. Always remember to clear your cache after implementing these changes and test your site's functionality thoroughly.
Related Support Threads Support
-
Object in edit boxhttps://wordpress.org/support/topic/object-in-edit-box/
-
“Classic editor, Classic Editor” on the list of entrieshttps://wordpress.org/support/topic/classic-editor-classic-editor-on-the-list-of-entries/
-
Missing custom buttons after update WordPress 6.0https://wordpress.org/support/topic/missing-custom-buttons-after-update-wordpress-6-0/
-
Remove database tables after deleting Classic Editorhttps://wordpress.org/support/topic/remove-database-tables-after-deleting-classic-editor/
-
Button remove link / unlinkhttps://wordpress.org/support/topic/button-remove-link-unlink/
-
Remove buttonshttps://wordpress.org/support/topic/remove-buttons-4/
-
Hide buttonhttps://wordpress.org/support/topic/hide-button-9/