Remove unused CSS and Javascript on theme
-
Hello, i checked the unused css on my front page and i saw that a total of 94% of the css is unused
the file is style.min.css.
how can i remove the unused code ? if i make it manually on the css child it will keep it ?
any suggestions ?
Hello,
Actually, if the code is unused on the front page it doesn’t mean that you can simply remove it. There are a lot of different elements and styles for pages that are not used on the front page but used on all other pages. That is why it is not possible simply to remove the CSS that you think is not needed on the home page since it will break other pages.
Kind Regards
i understand that. of course i will check all the pages that i am using. the question is if it will keep the changes if i am editing the file and save it in the child theme.
In this case, you will need to dequeue the file and enqueue it in the child theme.
https://developer.wordpress.org/reference/functions/wp_dequeue_style/