Title: hide empty attributes in generated html
Last modified: August 30, 2016

---

# hide empty attributes in generated html

 *  [iconiq](https://wordpress.org/support/users/iconiq/)
 * (@iconiq)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/hide-empty-attributes-in-generated-html/)
 * I created a custom shortcode with two possible attributes in the array (class,
   style). When I used the shortcode in a page and only populated one of the attribute
   fields, the generated markup still included the empty attribute field (see below:
 * <div class=”foo” style>sample text</div>
 * How can I omit the attr that aren’t used? the generated markup should look like
   this:
 * <div class=”foo”>sample text</div>
 * [https://wordpress.org/plugins/shortcodes-ultimate/](https://wordpress.org/plugins/shortcodes-ultimate/)

The topic ‘hide empty attributes in generated html’ is closed to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

## Tags

 * [attributes](https://wordpress.org/support/topic-tag/attributes/)

 * 0 replies
 * 1 participant
 * Last reply from: [iconiq](https://wordpress.org/support/users/iconiq/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/hide-empty-attributes-in-generated-html/)
 * Status: not resolved