Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to Customize the TinyMCE Editor in WordPress

A practical guide to WordPress TinyMCE customization using toolbar filters, initialization settings, custom JavaScript plugins, wp_editor(), and editor IDs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WordPress lets you tailor TinyMCE with PHP filters, per-editor settings, and (for new controls) JavaScript. Use mce_buttons, mce_buttons_2, mce_buttons_3, and mce_buttons_4 to change toolbar rows; use tiny_mce_before_init for configuration values; use mce_external_plugins when loading a custom JavaScript plugin; and use wp_editor() when rendering a separate editor instance. Always check the editor ID so a change affects only the screen you intend.

How WordPress exposes TinyMCE

TinyMCE is the Visual editor used by WordPress in places that still provide a classic editing surface. WordPress builds each editor from an initialization array and several filterable button and plugin lists. A filter receives the current value, and most editor filters also receive the editor ID. That second argument is the key to safe, targeted customization.

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.
Hook or API What it changes Typical use Implementation
mce_buttons First toolbar row Remove core controls or add a registered button PHP filter
mce_buttons_2 Second toolbar row Add formatting controls such as underline PHP filter
mce_buttons_3 Third toolbar row Place less-used controls on row three PHP filter
mce_buttons_4 Fourth toolbar row Place additional controls on row four PHP filter
tiny_mce_before_init Initialization values Change block formats or another TinyMCE option PHP filter
tiny_mce_plugins Built-in TinyMCE plugin list Adjust which bundled plugins are initialized PHP filter
mce_external_plugins External JavaScript plugins Load your own plugin file PHP filter plus JavaScript
wp_editor() One rendered editor instance Configure a metabox or custom admin screen PHP function and settings array

TinyMCE treats a toolbar list as an ordered list. The order in the filtered array is the order WordPress passes to TinyMCE, so adding a name at the end places that control after the existing controls in that row. A button name does not create functionality by itself: built-in names map to controls already known to the active TinyMCE build, while a new name must be supplied by a plugin.

Prepare a safe customization

  • Back up the site or test on staging before changing editor filters.
  • Put production snippets in a small site-specific plugin rather than editing WordPress core. A theme’s functions file can work, but the customization then disappears when the theme changes.
  • Confirm the editor context and its ID. The normal post editor uses content; the Classic block uses classic-block; a custom wp_editor() call uses the ID you supply.
  • Keep callbacks narrow. Return the original array or initialization values immediately when the ID is not the one you intend to change.
  • Test both Visual and Text or Code modes where both are available, then save a real post and inspect the resulting markup.

Remove or add toolbar buttons

Remove controls from the first row

The first-row filter receives the existing button names. This example removes the More and Fullscreen controls from the editor whose ID is content:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
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 numeric keys. If another plugin adds one of these buttons later in the filter sequence, filter priority determines which callback runs last; coordinate priorities when a conflict matters.

Add a built-in control to another row

To add a control that the active TinyMCE build already provides, append its button name to the appropriate row. The following adds underline to row two for the main post editor:

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.
add_filter( 'mce_buttons_2', function( $buttons, $editor_id ) {
    if ( 'content' === $editor_id ) {
        $buttons[] = 'underline';
    }

    return $buttons;
}, 10, 2 );

Use mce_buttons_2, mce_buttons_3, or mce_buttons_4 in the same way when you want a control on a later row. The row filters represent the four toolbar rows; they do not define a new button’s behavior. If the name is unknown to TinyMCE, WordPress may render no usable control.

Control order and duplicates

Before appending, inspect the existing array if duplicate entries would be confusing. You can test with in_array() and append only when the name is absent. To move a known button, remove it with array_diff(), then insert it at the desired position with normal PHP array operations. Keep the final list limited to controls supported by the current WordPress and TinyMCE versions running on the site.

Change TinyMCE initialization settings

Use tiny_mce_before_init when the requirement concerns an editor option rather than toolbar membership. The callback receives an initialization array and the editor ID. WordPress merges your returned values into the editor configuration, so change only the key you need and return every other value untouched.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Restrict the block-format menu

This example limits the format menu for the main content editor to Paragraph, Heading 2, and Heading 3:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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. Keep the callback scoped to the intended editor; changing every TinyMCE instance can unexpectedly affect metaboxes or plugins that embed their own editors.

Preserve WordPress’s cleanup behavior

Initialization also includes cleanup and allowed-element rules. Do not replace those defaults wholesale when your actual goal is a format-menu change. Overriding cleanup options can allow markup that the site’s workflow, theme, or security policy does not expect. Alter allowed or disallowed elements only when you have a specific requirement and have tested the saved output in both editing modes.

Add a custom TinyMCE button

A custom button has two parts: PHP registers a JavaScript plugin and places the button name on a toolbar row; JavaScript registers that name with TinyMCE and defines what happens when the user activates it.

Register the external plugin and button in PHP

Place this code in a site plugin. It loads mybutton.js from the same directory as the PHP file and adds the button only to the main content editor:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
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 registered in JavaScript and the button name added to the toolbar. The URL is generated with plugins_url(), so the file continues to resolve when the site’s plugin directory is moved.

Implement the button in JavaScript

Create mybutton.js beside the PHP file. This example inserts a paragraph with a class when clicked:

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

The JavaScript must load without console errors, register the same plugin name, and use APIs supported by the TinyMCE build bundled with the WordPress version in use. A custom control can open a dialog, insert a shortcode, or transform the current selection, but each behavior belongs in JavaScript; PHP alone only changes the server-side lists.

When to use tiny_mce_plugins

tiny_mce_plugins filters the list of TinyMCE plugins WordPress initializes. It is useful when you need to adjust the bundled plugin list, while mce_external_plugins is the normal registration point for a file outside that bundle. Loading an external plugin without adding its button leaves the feature hidden, and adding a button without loading its plugin leaves TinyMCE without an implementation.

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

Configure a separate editor with wp_editor()

For a custom metabox or admin screen, configure that editor at render time instead of changing every editor globally. The first argument is the initial content, the second is a unique editor ID, and the third is a settings array.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
wp_editor(
    $content,
    'summary_editor',
    array(
        'textarea_name' => 'summary',
        'media_buttons' => false,
        'teeny'         => false,
        'textarea_rows' => 12,
    )
);

Choose the ID and field name carefully

The editor ID must be unique on the page and should not contain square brackets. Use a distinct textarea_name for the submitted field; the ID identifies the JavaScript editor instance, while the textarea name identifies the posted value. Reusing either one can make two editors interfere with each other or cause the wrong field to be saved.

Useful per-instance settings

Setting Effect Decision to make
wpautop Controls WordPress paragraph and line-break processing Match the formatting expectations of the field
media_buttons Shows or hides the Add Media control Disable it for plain summaries or fields that should not accept media
default_editor Selects the initial editing mode Choose Visual or Text according to the workflow
drag_drop_upload Controls drag-and-drop uploads Enable only when the field should accept dropped files
textarea_name Sets the submitted form field name Use a unique, predictable name
textarea_rows Sets the initial textarea height Give longer content enough working space
teeny Requests a reduced toolbar Use for a deliberately minimal editor, then test which controls remain

Global filters can still affect an editor rendered with wp_editor(). If a per-instance editor needs a different toolbar, branch the filters on its custom ID rather than assuming the global post-editor configuration will apply.

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

Account for the Classic block

The Classic block initializes TinyMCE with the editor ID classic-block. A callback that checks only for content will therefore skip Classic blocks. If the same change belongs in both contexts, explicitly allow both IDs:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
add_filter( 'mce_buttons', function( $buttons, $editor_id ) {
    if ( ! in_array( $editor_id, array( 'content', 'classic-block' ), true ) ) {
        return $buttons;
    }

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

If the behavior should differ, use separate branches and separate button lists. Test a post editor, a newly inserted Classic block, and an existing post containing Classic blocks; they can initialize at different times and expose different surrounding controls.

Choose the right customization method

Need Best starting point Scope control Code required Main maintenance concern
Remove or reorder an existing control mce_buttons through mce_buttons_4 Editor ID passed to the filter PHP Other plugins may add the control later or change its name
Change a format menu or another option tiny_mce_before_init Editor ID and individual initialization keys PHP Replacing defaults can alter cleanup and saved markup
Expose a new action mce_external_plugins plus a toolbar filter Editor ID, plugin key, and button name PHP and JavaScript TinyMCE API compatibility and script errors
Build a self-contained metabox editor wp_editor() Unique ID and settings array PHP, with filters if needed Duplicate IDs, incorrect field names, and global filters
Adjust bundled plugin loading tiny_mce_plugins Usually all matching instances unless you branch elsewhere PHP Removing a dependency can make an existing button unavailable

Test and troubleshoot systematically

The button does not appear

  • Confirm the callback receives the editor ID you tested. Log or inspect the value during development instead of guessing.
  • Check that the button name is in the intended row array and is not being removed by a later filter.
  • For a custom button, verify that the external-plugin key, JavaScript registration name, and toolbar button name are identical.
  • Open the browser console and fix JavaScript syntax, loading, or API errors before testing the toolbar again.
  • Check whether the control is hidden by the current screen width or by a compact toolbar configuration.

The wrong editors change

Broadened callbacks are the usual cause. Compare the actual ID with the condition in every filter, including classic-block and IDs created by wp_editor(). Return the untouched value for every unrelated ID.

Formatting disappears after switching modes

Save a test post, switch between Visual and Text or Code modes, and inspect the stored HTML. A cleanup or allowed-element override may be stripping the markup. Remove unnecessary initialization overrides, then add only the specific element or attribute rule required by the content model.

Two editors interfere with one another

Give each wp_editor() instance a unique ID and a distinct textarea_name. Duplicate IDs can cause TinyMCE to attach to the wrong textarea, while duplicate field names can overwrite submitted values even when both editors look correct.

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

A plugin update changes the toolbar

Toolbar arrays are shared extension points. Another plugin can add, remove, or reorder names, and the active WordPress release can update the bundled TinyMCE build. Use explicit priorities only when necessary, avoid assumptions about an undocumented default order, and retest after WordPress, theme, or editor-plugin updates.

Deployment checklist

  1. Back up the database and files, or reproduce the change on staging.
  2. Put the PHP in a site plugin and keep the JavaScript file version-controlled with it.
  3. Identify every editor that should change: main content, Classic block, custom IDs, or all instances.
  4. Choose the narrowest hook: toolbar filter, initialization filter, plugin loader, or wp_editor() settings.
  5. Preserve the incoming arrays and initialization keys you are not deliberately changing.
  6. Test the Visual and Text or Code interfaces, media behavior, drag-and-drop behavior, and saved markup.
  7. Check the browser console and network panel for failed JavaScript files.
  8. Retest after updates to WordPress, the active theme, TinyMCE-related plugins, or your custom plugin.

With those boundaries in place, TinyMCE customization remains predictable: PHP controls which rows and plugins are available, JavaScript supplies genuinely new behavior, and editor IDs keep each change confined to the workflow that needs it.

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.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.