4

I've just started checking out the Twentytwenty theme but I can't change text color in my pages because the body color is set inline within a <style> tag called twentytwenty-style-inline-css which is generated by wp_head.

I understand the importance of these styles, but why override body?

I've looked all over and I cannot seem to find how to stop wp_head from generating these styles.

Is there any way to easily fix this or should I just us an older theme?

5
  • you can change colors in the admin area -> "Appearance" -> "Customise"
    – Kaperto
    Nov 22 '19 at 17:17
  • There doesn't seem to be an option for page text, just ones for links and background colors.
    – Eight
    Nov 22 '19 at 17:29
  • oh yes I read to quickly. to customise the text color, you can use the filter theme_mod_accent_accessible_colors.
    – Kaperto
    Nov 22 '19 at 17:54
  • Have you tried !important in your own CSS. Not ideal but it will tell you if its a priority problem. If it works let me know and I'll write it up as an answer. Nov 22 '19 at 19:51
  • 1
    @STEAMworksLearningCenter well yeah it would work but I'd rather not build my CSS around !important since that'd probably end up breaking other things.
    – Eight
    Nov 23 '19 at 18:19
7

https://wordpress.org/support/topic/remove-inline-styles-5/

 add_action( 'wp_enqueue_scripts', function() {
        $styles = wp_styles();
        $styles->add_data( 'twentytwenty-style', 'after', array() );
    }, 20 );
1
  • This worked for me - I was able to remove the inline styles from the head using this. Mar 26 '20 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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