Title: Linked and inline styles
Last modified: July 27, 2024

---

# Linked and inline styles

 *  Resolved [yorkslad12](https://wordpress.org/support/users/yorkslad12/)
 * (@yorkslad12)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/linked-and-inline-styles/)
 * Hello,
 * I was looking at my site source as I’m tidying it up for PageSpeed reasons. I
   noticed that the plugin has a <link> tag to a stylesheet, immediately followed
   by inline styles. This happens on every page, whether I use the code block/your
   plugin or not. Is there any reason to have it included on every page?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/linked-and-inline-styles/#post-17920898)
 * Hello! Yes, this is true. Originally the stylesheets were being printed conditionally
   when the Code block was printed, but this caused problems: [https://github.com/westonruter/syntax-highlighting-code-block/issues/286](https://github.com/westonruter/syntax-highlighting-code-block/issues/286)
 * So in [https://github.com/westonruter/syntax-highlighting-code-block/pull/785](https://github.com/westonruter/syntax-highlighting-code-block/pull/785)
   I switched it to register styles in the standard way.
 * If you’re using a Block theme, then the styles will continue to be conditionally
   included based on whether the Code block is on the page. For a Classic theme,
   however, this is not the default behavior for block styles. To opt-in, you have
   to add this code:
 *     ```wp-block-code
       add_filter( 'should_load_separate_core_block_assets', '__return_true' );
       ```
   
 * When you do this, all of the blocks on your site will start to be conditionally
   printed, not just the ones from the Code block. The downside is that the stylesheets
   are printed in the footer since in a Classic theme WordPress doesn’t know which
   blocks will be used before hand.
 * Let me know if this addresses the issue.
 *  Thread Starter [yorkslad12](https://wordpress.org/support/users/yorkslad12/)
 * (@yorkslad12)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/linked-and-inline-styles/#post-17923036)
 * Thanks for that suggestion. I’m using a ‘Frankentheme’, a theme I’ve had for 
   years which I made block-friendly several years ago.
 * Adding that filter removes the css and as far as I can tell has brought no adverse
   affects. So let’s say it’s worked 😉

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Linked and inline styles’ is closed to new replies.

 * ![](https://ps.w.org/syntax-highlighting-code-block/assets/icon.svg?rev=3406002)
 * [Syntax-highlighting Code Block (with Server-side Rendering)](https://wordpress.org/plugins/syntax-highlighting-code-block/)
 * [Support Threads](https://wordpress.org/support/plugin/syntax-highlighting-code-block/)
 * [Active Topics](https://wordpress.org/support/plugin/syntax-highlighting-code-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/syntax-highlighting-code-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [yorkslad12](https://wordpress.org/support/users/yorkslad12/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/linked-and-inline-styles/#post-17923036)
 * Status: resolved