[wp-trac] [WordPress Trac] #16996: oEmbed: Allow custom arguments to be specified
WordPress Trac
wp-trac at lists.automattic.com
Wed Jun 6 15:13:38 UTC 2012
#16996: oEmbed: Allow custom arguments to be specified
-------------------------------------+------------------------------
Reporter: newmediarts | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+------------------------------
Comment (by Otto42):
16996-filter.diff adds the simplest filter to get the job done that I can
think of.
With this filter, a plugin could enable arbitrary parameters using code
like this:
{{{
add_filter('oembed_fetch_url', 'foo', 10, 3);
function foo($provider, $args, $url) {
foreach ($args as $key=>$value) {
switch ($key) {
case 'width':
case 'height':
case 'discover': // ignore these args
break;
default:
$provider = add_query_arg( $key, $value, $provider
);
break;
}
}
return $provider;
}
}}}
Alternatively, it could use the URL param to be more discrete about it.
The provider url string is passed whole, so things like remove_query_arg
could be used to remove the width, for example (this is somewhat desirable
sometimes with Twitter's oembed implementation).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16996#comment:18>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list