Pepe
Pepe

Reputation: 521

How to edit the custom.css file in WordPress

Long story short: my WP developer disappeared and I have to do some fixes on my website by myself.

So far, so good.

But: there is one element I cannot change because there is an "... !important" line somewhere in the custom.css file.

How do I change the content of the file from WordPress? (I know I can edit simply the file but I would like to do it 'the WordPress way')

Upvotes: 0

Views: 241

Answers (2)

Philipmcnill
Philipmcnill

Reputation: 1

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:

wp_get_custom_css() that uses wp_get_custom_css_post() and displayed through the wp_head action with:

wp_custom_css_cb()

The best and easiest option is to create seaparate file and keep it in your website directory on the server. Then you can easy edit it with FTP access.

Upvotes: 0

Gagandeep Singh
Gagandeep Singh

Reputation: 1005

You can edit the file from WordPress's inbuilt theme editor which you can find under Appearances > Editor in the left menu on WordPress dashboard.

Hope it helps!

Upvotes: 1

Related Questions