By default, LearnDash loads all of its CSS files on every single page of your WordPress site. But many of your pages don’t include any LearnDash elements, and therefore don’t need this CSS.
This article will explore a few different ways to conditionally load LearnDash styles only on the pages that need it.
IMPORTANT
This is highly dependent on your specific setup, and may not work for everyone. Particularly, if you’re using shortcodes and/or Gutenberg blocks on non-LearnDash pages, the default code here will cause problems. You’ll need to customize it to also include those other pages where you’re using shortcodes, blocks or widgets in a sidebar.