Moments of clarity from Google are rare, so it’s nice to when they come out and say something simple and unambiguous like
The code to text ratio is not, and never has been, a factor in SEO.John Mueller / Google
Except… is this really true?
Assuming it’s safe to take Google at face value here and that there is not a ranking factor specifically measuring how much “code” (the stuff that makes up the page and its design but isn’t the stuff you read) there is compared to “text” (the stuff you actually read) then is it safe to just stuff as much code as you want into a page?
Err… no. Definitely not.
The reason for this is our old friend from Core Web Vitals, Site Speed.
So, whilst the specific ratio of code to text isn’t a ranking factor that’s no reason to let your pages get bloated with unnecessary code. This is especially important when working with a CMS like WordPress. In their efforts to make themes flexible and configurable, WordPress developers often have to write more complex code than would be required if they knew exactly the layout that they were producing ahead of time. More options means more code. If you know the layout you want, consider working with a developer to create a bespoke theme that with just the options, and code, that you need.
You can find the quote from Google and more at https://www.seroundtable.com/google-code-to-text-ratio-seo-factor-32889.html