Hi there,
I notice there is a 13kb roughly of inline CSS called "wpdiscuz-frontend-css-inline-css" injected.
I cannot remove this and ultimately do not want this to be loaded inline. In fact, it doesn't make sense for comments to load anything inline, since it is not above the fold, or cacheable.
How can I remove this specifically and other CSS so I can then manually load this at the footer as an external file?
Hi,
This inline CSS is dynamically generated, so it uses inline logic. For example, if you change a color, the CSS will update accordingly. It cannot be stored in a separate file, as doing so would break the logic.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
My colors are set in stone and never going to change, neither are any of the settings in wpdiscuz - can you provide some code to disable it inline and I'll load the same CSS as an external file?
I'm sorry, but currently there is not any solution for this.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
I appreciate that, but you can at least tell me where the inline code is being injected - so I at least comment it out, or better yet, some php that blocks it from loading?
The team has added this to our to-do list. We cannot provide an exact ETA for when it will be implemented, but I’ll update this topic once it’s included.
I’m sorry, but there’s currently no solution. If you comment it out, the entire CSS will be commented out.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
Well I mean I am not a coder but I asked ChatGPT and in 10 seconds it produced this for all inline:
add_action('template_redirect', function () {
ob_start(function ($html) {
// Match all <style> tags (in head or body)
preg_match_all('/<style.*?>(.*?)<\/style>/is', $html, $matches);
if (!empty($matches[1])) {
$css = implode("\n\n", $matches[1]);
// Save to a CSS file (e.g., /wp-content/uploads/inline-css.css)
$file_path = WP_CONTENT_DIR . '/uploads/inline-css.css';
file_put_contents($file_path, $css);
// Remove all inline <style> blocks
$html = preg_replace('/<style.*?>.*?<\/style>/is', '', $html);
// Add link to new external CSS file in head
$link_tag = '<link rel="stylesheet" href="' . content_url('uploads/inline-css.css') . '">';
$html = preg_replace('/<\/head>/', $link_tag . "\n</head>", $html);
}
return $html;
});
});
So I think with 2 minutes of your team looking at it, you could provide something useful?
We do not provide any guarantee for the code shared by ChatGPT or other community members. You are free to test the code and see if it works for your case. However, we won’t be able to offer support for any issues that may arise as a result of using it.
The answer I’ve provided was discussed with the team, and there’s nothing more I can add at this point: https://wpdiscuz.com/community/troubleshooting/inline-of-style-wpdiscuz-frontend-css-inline-css/#post-28952
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
I get it, but can you at least provide me code to remove the inline wpdiscuz produces, or tell me where to comment this out, so I can load it myself as an external file?

