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?



2021 年 4 月 29 日
If you get fed up of all the nag screens from themes and plugins nagging you to "Go Pro" etc, then this is a great plugin for adding css to hide them all. Really easy to use.
2021 年 4 月 1 日
Fantastic plugin, perfect for editing your admin panel. Not needing to deal with the hassle of php. files is great. I just hope this plugin gets an update for wordpress 5.7 soon as some things seem to not be working as they used to. Regardless, thank you so much Scott for your amazing work!
2020 年 7 月 2 日
In the latest wordpress with woo, litterally all 4 major "admin customizer" plugins are full of bugs: certain items are hidden or not hidden without reason. This plugin is simple and clean, and just works ! Without all the hastle and long interfaces.
2019 年 12 月 7 日
Very glad I tried this before faffing about with php files. Very easy – if you can use CSS, you can use this plugin.
2019 年 8 月 12 日
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!
閱讀全部 30 則使用者評論


以下人員參與了開源軟體〈Add Admin CSS〉的開發相關工作。


Add Admin CSS 外掛目前已有 2 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將 Add Admin CSS 外掛本地化為台灣繁體中文版


任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄


1.9.1 (2020-09-25)

  • Change: Update plugin framework to 051
    • Allow setting integer input value to include commas
    • Use number_format_i18n() to format integer value within input field
    • Update link to to be HTTPS
    • Update readme_url() to refer to plugin’s readme.txt on
    • Remove defunct line of code
  • Change: Note compatibility through WP 5.5+
  • Change: Restructure unit test file structure
    • New: Create new subdirectory phpunit/ to house all files related to unit testing
    • Change: Move bin/ to phpunit/bin/
    • Change: Move tests/bootstrap.php to phpunit/
    • Change: Move tests/ to phpunit/tests/
    • Change: Rename phpunit.xml to phpunit.xml.dist per best practices

1.9 (2020-06-26)


  • This minor release updates its plugin framework, adds a file, updates a few URLs to be HTTPS, expands unit testing, updates compatibility to be WP 4.9 through 5.4+, and minor behind-the-scenes tweaks.


  • Change: Allow class to always be instantiated, but add check to only register hooks when in the admin
  • Change: Change class names used for admin notice to match current WP convention
  • Change: Update plugin framework to 050
    • Allow a hash entry to literally have ‘0’ as a value without being entirely omitted when saved
    • Output donation markup using printf() rather than using string concatenation
    • Update copyright date (2020)
    • Note compatibility through WP 5.4+
    • Drop compatibility with version of WP older than 4.9
  • New: Add and move existing TODO list from top of main plugin file into it (and add to it)
  • Change: Tweak help text for ‘files’ setting for better phrasing and to remove extra sentence spaces
  • Change: Note compatibility through WP 5.4+
  • Change: Drop compatibility for version of WP older than 4.9
  • Change: Update links to to be HTTPS
  • Change: Add translator comment for string with multiple placeholders
  • CHange: Minor code reformatting
  • Unit tests:
    • New: Add test for options_page_description()
    • New: Add tests for default hooks
    • New: Add tests for setting and query param names
    • New: Label groupings of tests
    • Fix: Adjust tests to properly account for theme support or non-support of html5 when checking expected markup output
    • Fix: Ensure admin-related tests call test_turn_on_admin() so admin init actions are called
    • Fix: Invoke parent class’s setUp() during setUp()
    • Change: Remove unnecessary unregistering of hooks in tearDown()
    • Change: Move test_turn_on_admin() until just before first needed now that other tests can run before it
    • Change: Store plugin instance in class variable to simplify referencing it
    • Change: Use HTTPS for link to WP SVN repository in bin script for configuring unit tests (and delete commented-out code)

1.8 (2019-12-04)


  • This minor release adds HTML5 compliance when supported by the theme, modernizes and fixes unit tests, and notes compatibility through WP 5.3+.


  • New: Add HTML5 compliance by omitting type attribute when the theme supports ‘html5’
  • Unit tests:
    • New: Add unit test to ensure plugin is hooked to initialize on plugins_loaded
    • Fix: Don’t pass argument to plugin object’s add_css()
    • Fix: Don’t expect type attribute in link tags since they’re not HTML5-compliant
    • Fix: Prevent WP from attempting to print the emoji detection script (which isn’t built in the develop.svn repo)
    • Change: Update unit test install script and bootstrap to use latest WP unit test repo
  • Change: Note compatibility through WP 5.3+
  • Change: Update copyright date (2020)