Skip to content

Setting the default HTML editor in WordPress

By default, WordPress uses the Visual (WYSIWYG) editor for writing posts and pages. If you prefer working directly with HTML code, you can configure WordPress to open the HTML editor by default. On ruachost.com, this can be done by adding a short code snippet to your theme’s configuration.

  • Developers and advanced users may prefer editing raw HTML.
  • Provides more control over formatting and structure.
  • Avoids conflicts with the Visual editor’s auto‑formatting.
  1. Log in to WordPress with an administrator account.

  2. In the dashboard, go to Appearance → Theme Editor.

  3. From the right‑hand column, select the file named functions.php.

  4. Scroll to the bottom of the file and add the following code:

    add_filter( 'wp_default_editor', function() {
    return 'html';
    });
  5. Click Update File to save changes.

✅ WordPress will now open the HTML editor by default when creating or editing posts.

  • Always back up your theme files before making changes.
  • Consider creating a child theme to avoid losing customizations during theme updates.
  • If you switch themes, you’ll need to re‑apply this code to the new theme’s functions.php.