Title: get_styles_string generating CSS without valid property values
Last modified: November 29, 2019

---

# get_styles_string generating CSS without valid property values

 *  [tripflex](https://wordpress.org/support/users/tripflex/)
 * (@tripflex)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/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.

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

 *  Thread Starter [tripflex](https://wordpress.org/support/users/tripflex/)
 * (@tripflex)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/get_styles_string-generating-css-without-valid-property-values/#post-12190235)
 * After typing all this, and spending a while trying to debug why it was doing 
   this … I instead just switched in my plugin (WP Job Manager Emails) to instead
   use the internal WooCommerce Emogrifier instead of the version included in my
   plugin.
 * So while this may be something that the WC emogrifier is able to handle, may 
   be a good idea to keep in mind that other emogrifiers may have issues with this(
   or that this may come up at a later time).
 * Please feel free to close this if you would like.
 *  Plugin Contributor [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/get_styles_string-generating-css-without-valid-property-values/#post-12194936)
 * Thanks for posting, I’ll look into this!
    Ben

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

The topic ‘get_styles_string generating CSS without valid property values’ is closed
to new replies.

 * ![](https://ps.w.org/kadence-woocommerce-email-designer/assets/icon-256x256.png?
   rev=3115863)
 * [Kadence WooCommerce Email Designer](https://wordpress.org/plugins/kadence-woocommerce-email-designer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kadence-woocommerce-email-designer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/)
 * [Active Topics](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/get_styles_string-generating-css-without-valid-property-values/#post-12194936)
 * Status: not resolved