So I need to change multiple CSS Style sheet paths for a WordPress website. They rely on a domain that is no longer going to be active. What is the best way to apply the path of these CSS file to all pages within my website and future pages as they are created.

  • you want to point to an external location where your css files located? – MonTea Apr 3 '18 at 14:30
  • Yes. It is literally going from: domain1.com to domain2.com for all them and the paths after the .com are the same. Maybe a find and replace in NotePad++ by doing FTP, but would have to do each page one by one. – ztmcoder Apr 3 '18 at 14:54
  • If you use a Child-Theme u can add the changes to your header.php in the <head>, but I would copy the css files to your new domain and use it native. – MonTea Apr 3 '18 at 15:20
  • What if the header file doesn't match what is showing in the page source <header> section of each page? – ztmcoder Apr 4 '18 at 13:04

You can override your Header <head> ... </head> in the header.php of your Theme.

I prefere you create a Childtheme, if you don't know how, let me google that for you ;).

And than simply copy your header.php from your Parent Theme in /wp-content/themes/your-theme to /wp-content/themes/your-child-theme (replace the theme dir with yours).

And add your styles after <?php wp_head(); ?> and before </head> like normally css-styles will add:

<link rel="stylesheet" href="/wp-content/themes/your-child-theme/css/yourStylesheet.css" type='text/css' media='all' />

The Styles will add to each page.

Hope it helps.

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.