Title: HTML Embeds Require Valid Width
Last modified: August 31, 2016

---

# HTML Embeds Require Valid Width

 *  [gemedet](https://wordpress.org/support/users/gemedet/)
 * (@gemedet)
 * [10 years ago](https://wordpress.org/support/topic/html-embeds-require-valid-width/)
 * There seems to be a new requirement for iframes. The default rules generate this:
   `
   <figure class="op-social"><iframe src="https://www.youtube.com..."></iframe></
   figure>`
 * This used to work, but now it results in errors:
 * > HTML Embeds Require Valid Width: HTML Embeds require a valid integer width 
   > in order to be displayed properly.
   > HTML Embeds Require Valid Height: HTML Embeds require a valid integer height
   > in order to be displayed properly.
 * Manually adding the “width” and “height” attributes fixes it.
 * [https://wordpress.org/plugins/fb-instant-articles/](https://wordpress.org/plugins/fb-instant-articles/)

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

 *  [mlemberg](https://wordpress.org/support/users/mlemberg/)
 * (@mlemberg)
 * [10 years ago](https://wordpress.org/support/topic/html-embeds-require-valid-width/#post-7372383)
 * I get this error too.
 *  [namli](https://wordpress.org/support/users/namli/)
 * (@namli)
 * [10 years ago](https://wordpress.org/support/topic/html-embeds-require-valid-width/#post-7372420)
 * Same issue.
 * Both WordPress and Instant Articles for WP are updated to the latest version.
 *  [eperezf](https://wordpress.org/support/users/eperezf/)
 * (@eperezf)
 * [10 years ago](https://wordpress.org/support/topic/html-embeds-require-valid-width/#post-7372421)
 * Same here. Everything up to date. It’s not efficient to specify height and width
   of embeds since it’s better to use a responsive mode.
 *  [Gil Reich](https://wordpress.org/support/users/gil-reich/)
 * (@gil-reich)
 * [10 years ago](https://wordpress.org/support/topic/html-embeds-require-valid-width/#post-7372431)
 * I set the custom rules as below, to get the plugin to write out the height and
   width that are in the original source. There are a few different SocialEmbed 
   selectors, so if this doesn’t work on your code you may want to add height and
   width to other SocialEmbedRules.
 *     ```
       {
           "rules":
           [{
               "class": "SocialEmbedRule",
               "selector" : "//p[iframe]",
               "properties" : {
                   "socialembed.url" : {
                       "type" : "string",
                       "selector" : "iframe",
                       "attribute": "src"
                   },
                   "socialembed.height" : {
                       "type" : "int",
                       "selector" : "iframe",
                       "attribute": "height"
                   },
                   "socialembed.width" : {
                       "type" : "int",
                       "selector" : "iframe",
                       "attribute": "width"
                   },
                   "socialembed.iframe" : {
                       "type" : "children",
                       "selector" : "iframe"
                   },
                   "socialembed.caption" : {
                       "type" : "element",
                       "selector" : "figcaption"
                   }
               }
       	}]
       }
       ```
   

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

The topic ‘HTML Embeds Require Valid Width’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/fb-instant-articles_8fa0a4.svg)
 * [Instant Articles for WP](https://wordpress.org/plugins/fb-instant-articles/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/fb-instant-articles/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/fb-instant-articles/)
 * [Active Topics](https://wordpress.org/support/plugin/fb-instant-articles/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fb-instant-articles/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fb-instant-articles/reviews/)

 * 4 replies
 * 5 participants
 * Last reply from: [Gil Reich](https://wordpress.org/support/users/gil-reich/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/html-embeds-require-valid-width/#post-7372431)
 * Status: not resolved