queue_css_string — Add a CSS string to the current page.

Asset-related functions


queue_css_string($string, $media = 'all', $conditional = false)

Add a CSS string to the current page.

The inline stylesheet will appear in the head element. This needs to be called either before head() or in a plugin_header hook.

  • $string (string) – CSS string to include.
  • $media (string) – CSS media declaration, defaults to ‘all’.
  • $conditional (string|bool) – IE-style conditional comment, used generally to include IE-specific styles. Defaults to false.


head_css actually outputs the stylesheet markup. All themes should already call head_css themselves, so you can just use the queue functions.

If writing a theme, queue_css_* functions must be called before the call to head_css. If writing a plugin, you make these calls within the admin_head or public_head hooks.


Load css styles directly into the page head within <style></style> tags:

<?php queue_css_string("input.add-element {display: block}"); ?>