apply_filters( 'pre_oembed_result', null|string $result, string $url, string|array $args )
- Since
- 4.5.3
Filters the oEmbed result before any HTTP requests are made.
Description
This allows one to short-circuit the default logic, perhaps by replacing it with a routine that is more optimal for your setup.
Returning a non-null value from the filter will effectively short-circuit retrieval and return the passed value instead.
Compatibility
- WordPress
- since 4.5.3
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$resultnull|string- The UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
Default null to continue retrieving the result. $urlstring- The URL to the content that should be attempted to be embedded.
$argsstring|array- Additional arguments for retrieving embed HTML.
See wp_oembed_get() for accepted arguments. Default empty.
Where this hook fires · 1
wp-includes/class-wp-oembed.php:402WP_oEmbed::get_html()
Source code
* @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. * Default null to continue retrieving the result. * @param string $url The URL to the content that should be attempted to be embedded. * @param string|array $args Optional. Additional arguments for retrieving embed HTML. * See wp_oembed_get() for accepted arguments. Default empty. */ $pre = apply_filters( 'pre_oembed_result', null, $url, $args ); if ( null !== $pre ) { return $pre; } $data = $this->get_data( $url, $args );Changelog
Introduced in 4.5.3. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.