27

Wordpress Additional CSS

This image shows the Additional CSS feature in Wordpress. I'm trying to find the file that stores the additional CSS, but can't seem to find it anywhere - I've searched almost every folder in wp-content!

Does anyone know how Additional CSS for the theme is stored and, if it is in a file, where this file is located!

1
  • The best idea is keep it in separate file on the server. Than you can edite and make any changes quickly. Oct 9 at 1:40
36

It's stored in the database, within the wp_posts table, under the custom_css post type, where the post name is the theme slug. There you also have the related customize_changeset and revision post types.

The custom css post ID is also stored in the wp_options table under each theme mods, e.g. theme_mods_twentysixteen for Twenty Sixteen.

It's informative to check out how the custom CSS fetched from the database with:

and displayed through the wp_head action with:

3
  • If it's stored in the database does that mean that it will not be removed if/when I update my theme?
    – theyuv
    Oct 4 '17 at 13:15
  • 1
    updating the current theme, shouldn't remove the stored CSS.
    – birgire
    Oct 4 '17 at 15:01
  • This allowed me to copy the customizations from the parent theme to the child theme so I did not need to re-create the home page. Aug 13 '20 at 20:16
9

type this into the sql query if your new like me, and it should come up.

SELECT * FROM wp_posts WHERE post_type = 'custom_css'

Not the answer you're looking for? Browse other questions tagged or ask your own question.