[wp-trac] [WordPress Trac] #41403: Support "class" and "id" attributes on wp_oembed_get()

WordPress Trac noreply at wordpress.org
Fri Jul 21 19:58:50 UTC 2017


#41403: Support "class" and "id" attributes on wp_oembed_get()
--------------------------+-----------------------------
 Reporter:  ramiy         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The oembed function `wp_oembed_get( $url, $args )` allows us to set
 additional arguments for retrieving embed HTML.

 The problem is that currently the function supports two arguments, only
 `width` and `height`. In some cases developers need more flexibility, to
 set other HTML attributes like `id`, `class` and maybe even `title` (for
 better accessibility).

 ----

 I was trying to thinking of an example and I think that the simplest
 example would be [https://v4-alpha.getbootstrap.com/utilities/responsive-
 helpers/ bootstrap responsive embeds].

 {{{
 <div class="embed-responsive embed-responsive-21by9">
   <iframe class="embed-responsive-item" src="https://..."></iframe>
 </div>
 }}}

 Currently you can't set custom classes in iframe with the attributes:

 {{{
 wp_oembed_get( 'https://...', array( 'class' => 'embed-responsive-item' )
 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41403>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list