Add Admin CSS


Ever want to tweak the appearance of the WordPress admin pages by hiding stuff, moving stuff around, changing fonts, colors, sizes, etc? Any modification you may want to do with CSS can easily be done via this plugin.

Using this plugin you’ll easily be able to define additional CSS (inline and/or files by URL) to be added to all administration pages. You can define CSS to appear inline in the admin head (within style tags), or reference CSS files to be linked (via “link rel=’stylesheet'” tags). The referenced CSS files will appear in the admin head first, listed in the order defined in the plugin’s settings. Then any inline CSS are added to the admin head. Both values can be filtered for advanced customization (see Advanced section).

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage


The plugin exposes two filters for hooking. Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain). Bear in mind that the features controlled by these filters are also configurable via the plugin’s settings page. These filters are likely only of interest to advanced users able to code.

c2c_add_admin_css (filter)

The ‘c2c_add_admin_css’ filter allows customization of CSS that should be added directly to the admin page head.


  • $css (string): CSS styles.


 * Add CSS to admin pages.
 * @param string $css String to be added to admin pages.
 * @return string
function my_admin_css( $css ) {
    $css .= "
        #site-heading a span { color:blue !important; }
        #favorite-actions { display:none; }
    return $css;
add_filter( 'c2c_add_admin_css', 'my_admin_css' );

c2c_add_admin_css_files (filter)

The ‘c2c_add_admin_css_files’ filter allows programmatic modification of the list of CSS files to enqueue in the admin.


  • $files (array): Array of CSS files.


 * Add CSS file(s) to admin pages.
 * @param array $files CSS files to be added to admin pages.
 * @return array
function my_admin_css_files( $files ) {
    $files[] = '';
    return $files;
add_filter( 'c2c_add_admin_css_files', 'my_admin_css_files' );


  • A screenshot of the plugin's admin settings page.


  1. Install via the built-in WordPress plugin installer. Or download and unzip inside the plugins directory for your site (typically wp-content/plugins/)
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress
  3. Go to “Appearance” -> “Admin CSS” and specify some CSS to be added into all admin pages. (You can also use the “Settings” link in the plugin’s entry on the admin “Plugins” page).


Can I add CSS I defined via a file, or one that is hosted elsewhere?

Yes, via the “Admin CSS Files” input field on the plugin’s settings page.

Can I limit what admin pages the CSS gets output on?

No, not presently. At least not directly. By default, the CSS is added for every admin page on the site.

However, you can preface your selectors with admin page specific class(es) on ‘body’ tag to ensure CSS only applies on certain admin pages. (e.g. body.index-php h2, #icon-index { display: none; }).

Or, you can hook the ‘c2c_add_admin_css’ and ‘c2c_add_admin_css_files’ filters and determine the current admin page content to decide whether the respective hook argument should be returned (and thus output) or not.

Can I limit what users the CSS applies to?

No, not presently. At least not directly. By default, the CSS is added for any user that can enter the admin section of the site.

You can hook the ‘c2c_add_admin_css’ and ‘c2c_add_admin_css_files’ filters and determine the current user to decide whether the respective hook argument should be returned (and thus output) for the user or not.

How can I edit the plugin’s settings in the event I supplied CSS that prevents the admin pages from properly functioning or being seen?

It is certainly possible that you can put yourself in an unfortunate position by supplying CSS that could hide critical parts of admin pages, making it seeminly impossible to fix or revert your changes. Fortunately, there are a number of approaches you can take to correct the problem.

The recommended approach is to visit the URL for the plugin’s settings page, but appended with a special query parameter to disable the output of its JavaScript. The plugin’s settings page would typically be at a URL like Append &c2c-no-css=1 to that, so that the URL is (obviously change with the domain name for your site).

There are other approaches you can use, though they require direct database or server filesystem access:

  • Some browsers (such as Firefox, via View -> Page Style -> No Style) allow you to disable styles for sites loaded in that tab. Other browsers may also support such functionality natively or through an extension. Chrome has an extension called Web Developer that adds the functionality.
  • If you’re familiar with doing so and have an idea of what CSS style you added that is causing problems, you can use your browser’s developer tools to inspect the page, find the element in question, and disable the offending style.
  • In the site’s wp-config.php file, define a constant to disable output of the plugin-defined JavaScript: define( 'C2C_ADD_ADMIN_CSS_DISABLED', true );. You can then visit the site’s admin. Just remember to remove that line after you’ve fixed the CSS (or at least change “true” to “false”). This is an alternative to the query parameter approach described above, though it persists while the constant remains defined. There will be an admin notice on the plugin’s setting page to alert you to the fact that the constant is defined and effectively disabling the plugin from adding any CSS.
  • Presuming you know how to directly access the database: within the site’s database, find the row with the option_name field value of c2c_add_admin_css and delete that row. The settings you saved for the plugin will be deleted and it will be like you’ve installed the plugin for the first time.
  • If your server has WP-CLI installed, you can delete the plugin’s setting from the commandline: wp option delete c2c_add_admin_css

The initial reaction by some might be to remove the plugin from the server’s filesystem. This will certainly disable the plugin and prevent the CSS you configured through it from taking effect, restoring the access and functionality to the backend. However, reinstalling the plugin will put you back into the original predicament because the plugin will use the previously-configured settings, which wouldn’t have changed.

How do I disable syntax highlighting?

The plugin’s syntax highlighting of CSS (available on WP 4.9+) honors the built-in setting for whether syntax highlighting should be enabled or not.

To disable syntax highlighting, go to your profile page. Next to “Syntax Highlighting”, click the checkbox labeled “Disable syntax highlighting when editing code”. Note that this checkbox disables syntax highlighting throughout the admin interface and not just specifically for the plugin’s settings page.

Does this plugin include unit tests?



12 augustus 2019
Had a nagging issue with my theme settings causing editor to inherit page background colors. This plugin solved that and few other without having to mod functions files. Thumbs up Scott!
3 september 2016
Perfect to overcome the crappy native font idea of WordPress 4.6 🙂 Just add: body, textarea, #wpadminbar * { font-family: "Open Sans", sans-serif; }
Lees alle 25 beoordelingen

Bijdragers & ontwikkelaars

“Add Admin CSS” is open source software. De volgende personen hebben bijgedragen aan deze plugin.


“Add Admin CSS” is vertaald in 2 talen. Dank voor de vertalers voor hun bijdragen.

Vertaal “Add Admin CSS” naar jouw taal.

Interesse in ontwikkeling?

Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.




  • This release adds a recovery mode to disable output of CSS via the plugin (and an admin notice when it is active), improves documentation, updates the plugin framework, notes compatibility through WP 5.1+, drops compatibility with versions of WP older than 4.7, and more documentation and code improvements.


  • New: Add recovery mode to be able to disable output of CSS via the plugin
    • Add support for c2c-no-css query parameter for enabling recovery mode
    • Add support for C2C_ADD_ADMIN_CSS_DISABLED constant for enabling recovery mode
    • Display admin notice when recovery mode is active
    • Add can_show_css(), remove_query_param_from_redirects(), recovery_mode_notice()
  • Change: Initialize plugin on plugins_loaded action instead of on load
  • Change: Update plugin framework to 049
    • 049:
    • Correct last arg in call to add_settings_field() to be an array
    • Wrap help text for settings in label instead of p
    • Only use label for help text for checkboxes, otherwise use p
    • Ensure a textarea displays as a block to prevent orphaning of subsequent help text
    • Note compatibility through WP 5.1+
    • Update copyright date (2019)
    • 048:
    • When resetting options, delete the option rather than setting it with default values
    • Prevent double “Settings reset” admin notice upon settings reset
    • 047:
    • Don’t save default setting values to database on install
    • Change “Cheatin’, huh?” error messages to “Something went wrong.”, consistent with WP core
    • Note compatibility through WP 4.9+
    • Drop compatibility with version of WP older than 4.7
  • New: Add file
  • New: Add file and move all but most recent changelog entries into it
  • New: Add FAQ entry describing ways to fix having potentially crippled the admin
  • New: Add inline documentation for hooks
  • New: Add GitHub link to readme
  • Unit tests:
    • New: Add unit tests for add_css()
    • New: Add unit test for defaults for settings
    • Change: Improve tests for settings handling
    • Change: Update set_option() to accept an array of setting values to use
    • Change: Explicitly set ‘twentyseventeen’ as the theme to ensure testing against a known theme
    • Change: Invoke setup_options() within each test as needed instead of setUp()
  • Change: Store setting name in constant
  • Change: Cast return value of c2c_add_admin_css_files filter as an array
  • Change: Improve documentation for hooks within readme.txt
  • Change: Note compatibility through WP 5.1+
  • Change: Drop compatibility with version of WP older than 4.7
  • Change: Rename readme.txt section from ‘Advanced’ to ‘Hooks’ and provide a better section intro
  • Change: Update installation instruction to prefer built-in installer over .zip file
  • Change: Update copyright date (2019)
  • Change: Update License URI to be HTTPS

1.6 (2017-11-03)

  • New: Add support for CodeMirror (as packaged with WP 4.9)
    • Adds code highlighting, syntax checking, and other features
  • Fix: Show admin notifications for settings page
  • Change: Update plugin framework to 046
    • 046:
    • Fix reset_options() to reference instance variable $options.
    • Note compatibility through WP 4.7+.
    • Update copyright date (2017)
    • 045:
    • Ensure reset_options() resets values saved in the database.
    • 044:
    • Add reset_caches() to clear caches and memoized data. Use it in reset_options() and verify_config().
    • Add verify_options() with logic extracted from verify_config() for initializing default option attributes.
    • Add add_option() to add a new option to the plugin’s configuration.
    • Add filter ‘sanitized_option_names’ to allow modifying the list of whitelisted option names.
    • Change: Refactor get_option_names().
    • 043:
    • Disregard invalid lines supplied as part of hash option value.
    • 042:
    • Update disable_update_check() to check for HTTP and HTTPS for plugin update check API URL.
    • Translate “Donate” in footer message.
  • Change: Update unit test bootstrap
    • Default WP_TESTS_DIR to /tmp/wordpress-tests-lib rather than erroring out if not defined via environment variable
    • Enable more error output for unit tests
  • Change: Note compatibility through WP 4.9+
  • Change: Remove support for WordPress older than 4.6
  • Change: Update copyright date (2018)

1.5 (2016-04-21)

  • Change: Declare class as final.
  • Change: Update plugin framework to 041:
    • For a setting that is of datatype array, ensure its default value is an array.
    • Make verify_config() public.
    • Use <p class="description"> for input field help text instead of custom styled span.
    • Remove output of markup for adding icon to setting page header.
    • Remove styling for .c2c-input-help.
    • Add braces around the few remaining single line conditionals.
  • Change: Note compatibility through WP 4.5+.
  • Change: Remove ‘Domain Path’ from plugin header.
  • New: Add LICENSE file.

Full changelog is available in