Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

How to get CSS to update?

I've tried making changes to the style.css file in the child folder, but when I put the file online via FTP the changes aren't reflected.

I've tried other answers for similar issues:

  • creating the functions.php file just put raw php in the template
  • yes, I have checked that the template is active and I'm viewing it
  • I have disabled cacheing while using Chrome tools
  • tried viewing in another browser

I even tried referrring to navbar as an ID vs a class, or trying to change other IDs like "site-navigation" but it didn't make a difference.

Not sure what else I'm doing wrong.

Update: checked later and seems to have gone through. Maybe it takes some time to work...?

1 Answer

Yojance Rabelo
Yojance Rabelo
1,156 Points

Im not sure how you are enqueing your CSS files, but this might help you by making sure the CSS file will always be downloaded.

If you are enqueing the styles the right way, you might do something like this:

wp_enqueue_style( 'theme-styles', get_stylesheet_uri(), null, range( 1, 10 ), 'all' );

If you are just linking to the stylesheet from your header.php, add something like ?ver=1 to end of the file name.

<link rel="stylesheet" type="text/css" media="all" href="style.css?ver=<?php echo range( 1, 10 ); ?>" />