Back to Community

Why Isn't My Source Code Button Working in Advanced Editor Tools?

13 threads Sep 9, 2025 PluginAdvanced editor tools

Content

Many users of the Advanced Editor Tools plugin rely on the Source Code button to edit their content directly in HTML. A common and frustrating issue occurs when this button is missing from the toolbar or fails to display code formatting options. This guide will walk you through the most common causes and their solutions.

The Problem: A Missing or Non-Functional Source Code Button

Based on community reports, users typically encounter one of two problems:

  1. The Source Code button ( <>
  2. The button opens a pop-up window but no code formatting languages or styles are listed inside it.

Why This Happens

These issues stem from two different sources:

  • Toolbar Menu Dependency: A confirmed bug, potentially within the underlying TinyMCE library, causes the Source Code button to be removed if the top-level editor menu bar is disabled. This is a dependency that is not immediately obvious to the user.
  • Missing Configuration: The empty language list in the pop-up is not a bug, but rather a feature that requires manual configuration. The 'Code Sample' plugin, which provides syntax highlighting, needs its list of languages to be defined before it can display them.

How to Fix It: Common Solutions

Solution 1: Keep the Editor Menu Enabled

If your Source Code button vanishes when you disable the menu bar, the current workaround is to leave the menu enabled. To do this:

  1. Go to Settings → Advanced Editor Tools in your WordPress admin.
  2. Ensure the "Enable the editor menu." option is checked.
  3. Drag the Source Code button to your preferred toolbar location.
  4. Save your changes.

This will ensure the button remains visible. The Advanced Editor Tools team has acknowledged this behavior and may address it in a future update.

Solution 2: Configure the Code Sample Languages

If your button works but the pop-up is empty, you need to define which programming languages to display. This requires adding a code snippet to your theme's functions.php file or a custom plugin.

Add the following code to register a set of common languages:

function my_custom_codesample_languages( $languages ) {
    return array(
        array( 'text' => 'HTML/XML', 'value' => 'markup' ),
        array( 'text' => 'JavaScript', 'value' => 'javascript' ),
        array( 'text' => 'CSS', 'value' => 'css' ),
        array( 'text' => 'PHP', 'value' => 'php' ),
        array( 'text' => 'Python', 'value' => 'python' )
    );
}
add_filter( 'tiny_mce_before_init', 'my_custom_codesample_settings' );

function my_custom_codesample_settings( $settings ) {
    $settings['codesample_languages'] = wp_json_encode( my_custom_codesample_languages( array() ) );
    return $settings;
}

Warning: Editing theme files directly can break your site if done incorrectly. Always use a child theme and create a backup before proceeding, or consider using a code snippets plugin.

Solution 3: Clear Your Browser Cache

After making any changes in the Advanced Editor Tools settings, it is crucial to clear your browser's cache. Several users have reported that changes do not become visible until they completely log out of WordPress and clear their browser's cached files. This ensures you are seeing the most recent version of the editor toolbar.

Conclusion

A non-functional Source Code button is usually caused by a menu dependency bug or a missing configuration. The solutions above should resolve the issue for most users. For further reading, you can explore other community discussions about Advanced Editor Tools.