sandywp / plugins / dark-mode-for-wp-dashboard

Dark Mode for WP Dashboard

4.8 out of 5 stars. 4.8 35 reviews

A clean, lightweight dark mode for the WordPress admin dashboard.

Launch a sandbox with this plugin → No signup.
Ready in seconds.

v1.3.11 3,000+ installs WP 6.0+ PHP 7.4+

your-sandbox.sandywp.com/wp-admin
Dark Mode for WP Dashboard running inside a SandyWP sandbox

What you get inside

3 screens
  • Dashboard

  • Plugins

  • Pages

About this plugin

No settings page, no bloat — just activate and go. Dark mode for every corner of your WordPress admin.

  • Instant toggle in the admin bar — no page reload
  • Per-user preference: Dark / Light / Auto (follows system)
  • Full block editor and Site Editor support
  • 14 popular plugins supported out of the box
  • Developer-friendly: filters for default preference, custom CSS, and editor canvas control

Supported plugins:

  • Advanced Custom Fields
  • AIOSEO
  • Better Search Replace
  • Code Snippets
  • Jetpack
  • Kadence Blocks
  • Nested Pages
  • SmartCrawl SEO
  • Smush
  • The SEO Framework
  • WooCommerce
  • WPCode (Insert Headers and Footers)
  • Yoast SEO (including Premium, Local, News, WooCommerce)
  • Zamok

The plugin adds a dark-mode class to the admin body when active, and provides three filters for customization:

  • add_filter( 'dark_mode_dashboard_css', 'your_stylesheet_url' ) — replace the plugin’s admin stylesheet with your own. This swaps the whole file rather than adding to it, so your stylesheet has to cover everything the plugin’s does, and it does not affect the post editor’s content area. To add a few rules of your own instead, enqueue a second stylesheet — see the FAQ
  • add_filter( 'dark_mode_dashboard_default_preference', function() { return 'disabled'; } ) — change the default mode for new users
  • add_filter( 'dark_mode_dashboard_editor_canvas', '__return_false' ) — disable dark mode for the editor content area

Questions

How do I add my own CSS to the admin?

Don’t edit the files inside the plugin — an update overwrites them. And dark_mode_dashboard_css is not the filter for this: it replaces the plugin’s admin stylesheet rather than adding to it, and it does not reach the post editor’s content area, which is a separate stylesheet.

To add rules of your own, enqueue your own stylesheet from your theme’s functions.php:

add_action( 'admin_enqueue_scripts', function () {
    wp_enqueue_style(
        'my-admin-tweaks',
        get_stylesheet_directory_uri() . '/admin-tweaks.css',
        array( 'dark-mode-dashboard' ),
        '1.0'
    );
} );

Naming dark-mode-dashboard as a dependency makes your file load after the plugin’s, so your rules win without needing !important. Note that a dependency also pulls the plugin’s stylesheet in for users who have dark mode switched off, who would otherwise download almost nothing. If that matters to you, drop the dependency and hook in at a later priority instead:

add_action( 'admin_enqueue_scripts', function () {
    wp_enqueue_style( 'my-admin-tweaks', get_stylesheet_directory_uri() . '/admin-tweaks.css', array(), '1.0' );
}, 20 );

How do I change the font or size in the post editor?

The post content renders inside an iframe, and only styles enqueued on enqueue_block_assets are carried into it:

add_action( 'enqueue_block_assets', function () {
    if ( ! is_admin() ) {
        return;
    }
    wp_enqueue_style(
        'my-editor-fonts',
        get_stylesheet_directory_uri() . '/editor-fonts.css',
        array(),
        '1.0'
    );
} );

One thing catches people out. Inside that iframe the body element is itself the .editor-styles-wrapper element — not its parent. So write the selector as a single compound with no space between the two classes:

body.editor-styles-wrapper p { font: 22px/1.5 Georgia, serif; }

Written as body.dark-mode .editor-styles-wrapper p, with a space, it looks for a wrapper nested inside the body, finds nothing, and silently does nothing. Use body.dark-mode.editor-styles-wrapper p to apply a rule in dark mode only, or leave .dark-mode out to apply it in both modes.

Which class does the plugin add?

dark-mode on the admin body when dark mode is on, and dark-mode-auto when the preference is Auto. Auto deliberately does not also get dark-mode, so that it can follow the operating system.

4.8

35 reviews

  • 5 ★ 31
  • 4 ★ 3
  • 3 ★ 0
  • 2 ★ 1
  • 1 ★ 0

Ratings come from WordPress.org. SandyWP does not collect its own reviews.

sandywp / also on the shelf

Try another plugin

Spin up a real WordPress site in seconds.

Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.