[wp-trac] [WordPress Trac] #11603: Ensure that oEmbed returns XHTML valid code

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 24 23:19:30 UTC 2009


#11603: Ensure that oEmbed returns XHTML valid code
-------------------------+--------------------------------------------------
 Reporter:  hpguru       |       Owner:             
     Type:  enhancement  |      Status:  new        
 Priority:  normal       |   Milestone:  3.0        
Component:  Validation   |     Version:  2.9        
 Severity:  normal       |    Keywords:  needs-patch
-------------------------+--------------------------------------------------
Changes (by dd32):

  * keywords:  oEmbed => needs-patch


Comment:

 The issue at heart here, Is that your doctype does not allow the usage of
 {{{<embed>}}} which is required for older non-XHTML compliant browsers.

 In an environment where you're using XHTML, you'll probably need to filter
 out the non-compliant elements, as oEmbed is designed to use the trusted
 code from the embedder. And its unlikely WordPress is going to mess with
 the results, because removing {{{embed}}} means removing support for older
 browsers (No idea which browsers..)

 In your case, something like this (untested) will achieve it:
 {{{
 add_filter('oembed_dataparse', '_strip_embed');
 function _strip_embed($data) {
     $data = preg_replace('|<embed.+?>.*?</embed>|i', '', $data);
     return $data;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11603#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list