W3C Validator Charset Error

Sometimes the W3C validator will give you this error:

Error: A charset attribute on a meta element found after the first 1024 bytes.

This can be because when certain features are active in WP Rocket, like minification and DNS Prefetch, we add code to the beginning of the <head>.

There are a couple of approaches to solving this:


Remove the meta charset tag from your theme

WP Rocket places the charset in the .htaccess file which is better for performance, so you don’t need it in the theme as well.


Move meta charset to beginning of the head

Alternatively you can install the small plugin found below which will move the meta charset tag to the start of the <head>, thereby satisfying the W3C validator.

Download the ZIP file via the link below, then install it as a plugin through your WordPress dashboard:

📥  Download (.zip):  WP Rocket | Meta Charset

Developers: You can find the code for this plugin on GitHub.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.