Filter hook 'embed_oembed_discover'

in WP Core File wp-includes/class-wp-embed.php at line 305

View Source

embed_oembed_discover

Filter Hook
Description
Filters whether to inspect the given URL for discoverable link tags.

Hook Information

File Location wp-includes/class-wp-embed.php View on GitHub
Hook Type Filter
Line Number 305

Hook Parameters

Type Name Description
bool $enable Whether to enable `` tag discovery. Default true.

Usage Examples

Basic Usage
<?php
// Hook into embed_oembed_discover
add_filter('embed_oembed_discover', 'my_custom_filter', 10, 1);

function my_custom_filter($enable) {
    // Your custom filtering logic here
    return $enable;
}

Source Code Context

wp-includes/class-wp-embed.php:305 - How this hook is used in WordPress core
<?php
 300  		 *
 301  		 * @see WP_oEmbed::discover()
 302  		 *
 303  		 * @param bool $enable Whether to enable `<link>` tag discovery. Default true.
 304  		 */
 305  		$attr['discover'] = apply_filters( 'embed_oembed_discover', true );
 306  
 307  		// Use oEmbed to get the HTML.
 308  		$html = wp_oembed_get( $url, $attr );
 309  
 310  		if ( $post_id ) {

PHP Documentation

<?php
/**
		 * Filters whether to inspect the given URL for discoverable link tags.
		 *
		 * @since 2.9.0
		 * @since 4.4.0 The default value changed to true.
		 *
		 * @see WP_oEmbed::discover()
		 *
		 * @param bool $enable Whether to enable `<link>` tag discovery. Default true.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-embed.php
Related Hooks

Related hooks will be displayed here in future updates.