0

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')

2 Answers 2

1

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!

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for the answer. But it let you edit style.css while I need - custom.css.
When we open the editor it shows us the style.css file by default as it is the most basic file providing information about the theme, and if you see to the right of the editor window, you can see all the files and directories listed under your current active theme, just navigate to the custom.css file and select it.
OK, I see the problem. There is no custom.css bu there is custom_css.php.So the custom.css must be dynamically generated somehow.
Yes, this can also be the case, you can have some idea about from where the file is getting generated by looking at its full path from developer tools in browser.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.