get_styles_string generating CSS without valid property values
-
After helping a client of mine to debug an issue as to why CSS was being stripped from emails when being sent, I was able to track down the issue being due to invalid CSS being generated in the
Kadence_Woomail_Customizer::get_styles_string
method, which resulted in an Emogrifier error.As just one example, this CSS was being generated/output:
#body_content_inner table.td{ background-color:;}
Which is generated from the
items_table_background_color
setting.This is only one of the issues, there’s probably 20 other invalid CSS rules being generated
The problem is that, the default setting value, is an empty string. So when an empty value is being set for that CSS to be generated, your plugin is still generating the CSS for that element, ultimately resulting in invalid CSS.
In the
Kadence_Woomail_Customizer::get_styles_string
method where you loop through each property to generate the CSS, you should probably add a check something like:
if( $property_value === '' ){ continue; }
As to not generate invalid CSS properties. I had to manually edit my client’s copy of your plugin to fix this, hopefully you can include a patch for this in the next release to prevent invalid CSS from being generated.
- The topic ‘get_styles_string generating CSS without valid property values’ is closed to new replies.