Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Customize the TinyMCE Editor in WordPress

A practical, code-focused guide to customizing WordPress TinyMCE with toolbar filters, initialization settings, wp_editor(), external JavaScript plugins, editor IDs, and troubleshooting steps.
WorldWordPress Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can customize WordPress’s TinyMCE editor with PHP filters, per-editor settings, and—when needed—a JavaScript plugin. Use mce_buttons through mce_buttons_4 to add or remove toolbar controls, tiny_mce_before_init to change editor options, and wp_editor() to configure a specific editor instance. The critical detail is scope: WordPress passes an editor ID, so a change can target the main post editor, the Classic block, or a custom metabox instead of every editor on the site.

How WordPress exposes TinyMCE customization

TinyMCE is the Visual editor used by WordPress in the main post editor, the Classic block, and many custom admin screens. WordPress builds each instance from an initialization array, a toolbar-button list, and a set of loaded plugins. Filters let you modify those pieces before the editor is created.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Need API or hook What it changes Typical implementation
Add or remove toolbar controls mce_buttons, mce_buttons_2, mce_buttons_3, mce_buttons_4 The button names and order in rows one through four of the Visual toolbar PHP filter only
Change an editor option tiny_mce_before_init Initialization values such as block formats and other TinyMCE settings PHP filter, usually scoped by editor ID
Load a JavaScript TinyMCE plugin mce_external_plugins The external plugin name and JavaScript URL PHP registration plus JavaScript
Alter the general plugin list tiny_mce_plugins Plugins WordPress includes when assembling the editor PHP filter; use only when you understand the resulting dependencies
Render a separately configured editor wp_editor() One editor’s content, ID, textarea name, rows, media controls, and related settings PHP where the metabox or admin screen is rendered

TinyMCE toolbar settings are ordered lists: the array sequence determines the left-to-right order of controls. A button cannot work merely because its name is in a toolbar array; the corresponding TinyMCE plugin must also be loaded.

Prepare safely before changing the editor

  • Work in a staging site or make a backup. A malformed PHP callback can prevent the administration area from loading, and an invalid editor setting can affect every post-editing screen.
  • Use a site-specific plugin or a child-theme functions file. Do not edit WordPress core. A small plugin keeps the customization independent of a theme switch.
  • Identify the editor ID. The normal post editor uses content. The Classic block uses classic-block. A custom call to wp_editor() uses the ID you supply.
  • Confirm the button slug. Toolbar arrays contain TinyMCE control names such as wp_more, fullscreen, or underline, not the visible label translated to your language.
  • Plan for other plugins. Multiple callbacks can append, remove, or reorder the same button. Keep your callback narrow and return the incoming array or initialization values when your condition is not met.

Add and remove buttons from the toolbar

Remove controls from the first row

The mce_buttons filter receives the first-row button array and the editor ID. This example removes the More tag and Fullscreen controls only from the main post editor:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
add_filter( 'mce_buttons', function( $buttons, $editor_id ) {
    if ( 'content' !== $editor_id ) {
        return $buttons;
    }

    return array_values( array_diff( $buttons, array( 'wp_more', 'fullscreen' ) ) );
}, 10, 2 );

array_diff() removes matching names without disturbing the other controls. array_values() reindexes the result, which avoids gaps in the array after removal. If you want the controls removed from another editor, change the ID check deliberately rather than deleting the check.

Add a control to the second row

Use mce_buttons_2 for the second Visual-toolbar row. The callback below adds Underline to the main editor while leaving other instances unchanged:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
add_filter( 'mce_buttons_2', function( $buttons, $editor_id ) {
    if ( 'content' === $editor_id ) {
        $buttons[] = 'underline';
    }

    return $buttons;
}, 10, 2 );

Appending places the new control after the existing second-row buttons. To position it elsewhere, build a new ordered array or insert it at a known index, but preserve unknown buttons supplied by WordPress and other plugins unless you intentionally want to replace the row.

Use the third and fourth rows when they exist

mce_buttons_3 and mce_buttons_4 target the third and fourth rows. Many WordPress installations do not display all four rows by default, so adding a button to row three or four may have no visible effect if that row is not enabled by the active editor configuration. The same callback pattern applies:

add_filter( 'mce_buttons_3', function( $buttons, $editor_id ) {
    if ( 'content' === $editor_id ) {
        $buttons[] = 'mybutton';
    }

    return $buttons;
}, 10, 2 );

Use a row filter for membership and ordering only. If the change concerns a menu, formatting rule, URL behavior, or another TinyMCE option, use tiny_mce_before_init instead.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Understand toolbar names and ordering

A toolbar array is not a list of labels. It contains registered TinyMCE button identifiers. Core controls and controls supplied by plugins have different names, and a name is case-sensitive. If a button appears as text, does nothing, or disappears after another plugin loads, inspect whether its plugin is present and whether a later callback changed the array.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Change TinyMCE initialization settings

The tiny_mce_before_init filter is for configuration values rather than toolbar membership. WordPress passes the initialization array and editor ID. Modify only the value you need and return the rest unchanged.

Limit the block-format menu

This example changes the format dropdown for the main editor so it offers Paragraph, Heading 2, and Heading 3:

add_filter( 'tiny_mce_before_init', function( $init, $editor_id ) {
    if ( 'content' === $editor_id ) {
        $init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3';
    }

    return $init;
}, 10, 2 );

The value is a semicolon-separated list of labels and HTML elements. The label is what authors see; the element after the equals sign is what TinyMCE inserts. If you need a different format set in another editor, branch on its ID instead of changing the value globally.

Preserve WordPress’s normal cleanup behavior

WordPress merges custom values into its editor defaults and applies cleanup rules for allowed and disallowed elements. Do not replace the entire initialization array, and do not remove cleanup settings simply to make a custom tag appear. Change those rules only when you have a specific requirement, understand the security implications, and have tested saved content in both Visual and Text or Code modes.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Configure one editor with wp_editor()

For a custom metabox or admin screen, call wp_editor( $content, $editor_id, $settings ) where the editor should be rendered. The ID must be unique on the page and should not contain square brackets. Use a distinct textarea_name for the submitted field.

wp_editor(
    $content,
    'summary_editor',
    array(
        'textarea_name' => 'summary',
        'media_buttons' => false,
        'teeny'         => false,
        'textarea_rows' => 12,
    )
);

Important wp_editor() settings

Setting Effect When to use it
wpautop Controls WordPress paragraph and line-break formatting Set only when you understand how automatic paragraphs affect the stored content
media_buttons Shows or hides the Add Media controls above the editor Set false for fields that should contain text only
default_editor Selects the initial Visual or Text editor mode Use when a particular workflow requires one mode on opening
drag_drop_upload Enables or disables drag-and-drop uploads Disable it for fields that must not accept media uploads
textarea_name Sets the form field name submitted with the page Always provide a distinct, predictable name for custom fields
textarea_rows Sets the approximate number of visible text rows Choose a height appropriate to the field’s expected content
teeny Requests a reduced toolbar configuration Use for deliberately minimal editors; do not combine it with assumptions about the full toolbar

When several editors appear on one screen, give every instance a unique ID. Reusing an ID can cause initialization scripts to target the wrong textarea or leave one editor uninitialized.

Build a custom TinyMCE button

A custom button has two parts: PHP registers a JavaScript plugin and adds the button name to a toolbar; JavaScript registers that plugin with TinyMCE and defines what the control does.

Register the external plugin and toolbar button

Place this PHP in a site plugin or another update-safe location. The callback is scoped to the main post editor:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
add_filter( 'mce_external_plugins', function( $plugins, $editor_id ) {
    if ( 'content' === $editor_id ) {
        $plugins['mybutton'] = plugins_url( 'mybutton.js', __FILE__ );
    }

    return $plugins;
}, 10, 2 );

add_filter( 'mce_buttons', function( $buttons, $editor_id ) {
    if ( 'content' === $editor_id ) {
        $buttons[] = 'mybutton';
    }

    return $buttons;
}, 10, 2 );

The array key, mybutton, must match the plugin name used by the JavaScript registration and the button name added to the toolbar. plugins_url( 'mybutton.js', __FILE__ ) produces a URL relative to the plugin file, so the script can move with the plugin rather than being hard-coded to a domain.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Implement the button in JavaScript

A classic TinyMCE API implementation can register a button and insert content at the current caret position:

(function() {
    tinymce.PluginManager.add('mybutton', function(editor) {
        editor.addButton('mybutton', {
            text: 'Insert note',
            icon: false,
            onclick: function() {
                editor.insertContent('<span class="game-note">Add your note</span>');
            }
        });
    });
})();

The JavaScript API available in the active WordPress and TinyMCE versions determines whether editor.addButton() or a newer UI-registration method is appropriate. Check the bundled TinyMCE build before shipping a plugin, and escape or sanitize any user-provided value before inserting it. The example inserts a fixed span; it does not create a secure editor for arbitrary HTML.

Keep plugin loading and toolbar registration together

Registering an external plugin without adding its button loads code that authors cannot reach. Adding a button name without loading its plugin creates a toolbar entry that TinyMCE cannot implement. Test both halves in the same editor instance, then check the browser console for JavaScript errors if the control is missing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When to use tiny_mce_plugins

The tiny_mce_plugins filter changes the plugin list WordPress assembles for TinyMCE. It is broader and more fragile than mce_external_plugins, because removing or replacing a plugin can affect controls, formats, and behavior that other code expects. For a new custom button, prefer mce_external_plugins plus a matching mce_buttons entry. Use tiny_mce_plugins only when the requirement is specifically to alter the general loaded-plugin list and you have tested all dependent controls.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make changes work in the Classic block

The block editor’s Classic block initializes TinyMCE with the editor ID classic-block, not content. A callback that checks only for content will therefore affect the main post editor but not Classic blocks.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
add_filter( 'mce_buttons', function( $buttons, $editor_id ) {
    if ( in_array( $editor_id, array( 'content', 'classic-block' ), true ) ) {
        $buttons[] = 'underline';
    }

    return $buttons;
}, 10, 2 );

Use the same deliberate branching for mce_buttons_2, tiny_mce_before_init, and mce_external_plugins when both contexts need the feature. If a custom editor created with wp_editor() also needs it, add that editor’s unique ID to the condition. Do not assume that a change visible in one context automatically propagates to the others.

Choose the right customization method

Goal Scope Code required Maintenance considerations
Hide or reorder an existing control One or more editor IDs PHP filter on the relevant mce_buttons* row Button names and row availability can vary with WordPress and other plugins
Change formats or another TinyMCE option One or more editor IDs PHP filter on tiny_mce_before_init Preserve WordPress defaults and test generated HTML
Add a new command Selected editor IDs PHP plus JavaScript via mce_external_plugins and mce_buttons Keep the script compatible with the active TinyMCE build and handle security
Provide a special metabox editor One explicit instance wp_editor() settings, optionally combined with filters IDs and textarea names must be unique; multiple instances need separate testing
Alter the global plugin set Every TinyMCE instance reached by the filter tiny_mce_plugins Highest compatibility risk because other controls may depend on removed plugins

Verify the result and diagnose failures

  1. Test in staging first. Open the post editor, a page editor, and any custom screen that uses TinyMCE.
  2. Check the exact context. Confirm whether the failing editor ID is content, classic-block, or your custom ID. Add a branch for each context that should receive the change.
  3. Inspect every toolbar row. A button added to mce_buttons_2 will not appear in row one. A row that is not rendered cannot display its controls.
  4. Check the browser console and network panel. A 404 for the external JavaScript file, a syntax error, or a plugin-registration error prevents a custom button from appearing.
  5. Confirm the names match. The key in mce_external_plugins, the name passed to tinymce.PluginManager.add(), and the toolbar button name must agree.
  6. Switch between Visual and Text or Code modes. Save a test post after switching and inspect whether the resulting HTML is valid. A toolbar control can appear correctly while inserting markup that WordPress later cleans or transforms.
  7. Temporarily disable competing customizations. If another plugin or theme callback runs later, it may remove your button or overwrite an initialization value. Adjust hook priority only after identifying the conflict.
  8. Clear stale assets and reload. Browser caching or an asset-cache layer can serve an older JavaScript file. Reload the editor after confirming the current script URL.

Button is absent but PHP runs

First verify the editor ID and the row filter. Then determine whether the button is a core control or belongs to a plugin. If it is custom, confirm both plugin registration and toolbar registration. A correct PHP callback cannot create a button whose JavaScript plugin failed to load.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Button appears but clicking it does nothing

Open the console for JavaScript exceptions, check that the plugin callback registered the same name, and verify that the handler uses the TinyMCE API supported by the active build. If the handler inserts HTML, test with a simple fixed string before adding dialogs, network requests, or user input.

Formatting disappears after saving

Inspect the saved HTML in Text or Code mode and review the initialization and cleanup settings. WordPress may remove elements or attributes that are not allowed by the current configuration. Change cleanup rules only for a defined requirement and test the result with users who have the same role and editor permissions.

Maintain customizations across WordPress updates

  • Keep callbacks small and conditional. Return the original value immediately for unrelated editor IDs.
  • Document the reason for each button and setting. Future maintainers can remove obsolete code instead of stacking duplicate filters.
  • Retest after WordPress or TinyMCE updates. The documented hook names remain the integration points, but the bundled TinyMCE build, default buttons, and JavaScript APIs can change.
  • Test with the plugins that modify the editor. Toolbar order and plugin loading are shared surfaces; compatibility depends on the complete active stack, not your callback alone.
  • Keep JavaScript version-aware. Use the API supported by the TinyMCE build bundled with the WordPress version you support, and avoid assuming that an example written for another build will work unchanged.
  • Review permissions and output. A custom button that inserts HTML must not bypass WordPress’s normal sanitization or expose untrusted input to authors without the required capability.

The Bottom Line

Use the narrowest hook that matches the job: mce_buttons* for toolbar rows, tiny_mce_before_init for settings, wp_editor() for one rendered instance, and mce_external_plugins plus JavaScript for a genuinely new button.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.