You can use the wp_add_inline_style()
function to override styles in an already-enqueued stylesheet:
add_action( 'admin_enqueue_scripts', 'wpse127850_css_overrides' );
function wpse127850_css_overrides() {
wp_add_inline_style( 'color', '.mycolor { background: #ccc; }' );
}
You’ll need to find the handle of the stylesheet you want to affect — I’ve guessed at color
but there’s no guarantee I’m right.
References
Edited to answer questions from the comments
- The function name can be whatever you want — it just has to match the 2nd parameter of the
add_action()
call. -
color
is the CSS file’s “handle” — if you View Source of your admin page, you’ll see that all the stylesheets are called like this:<link rel="stylesheet" id='the-erudite-css' href="http://example.com/wp-content/themes/the-erudite/css/erudite.css?ver=3.8" type="text/css" media="all" />
The
id
part contains the CSS file’s handle, followed by-css
. So in my example, the handle isthe-erudite
. - I know this because I went looking for this ability one day, and figured it out by a combination of Google and Codex searching. The WordPress Codex is a fantastic resource for any WordPress development you’re trying to do. If you haven’t yet, you should visit — and probably bookmark — it.