Filter hook 'load_default_embeds'

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

View Source

load_default_embeds

Filter Hook
Description
Filters whether to load the default embed handlers. Returning a falsey value will prevent loading the default embed handlers.

Hook Information

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

Hook Parameters

Type Name Description
bool $maybe_load_embeds Whether to load the embeds library. Default true.

Usage Examples

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

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

Source Code Context

wp-includes/embed.php:201 - How this hook is used in WordPress core
<?php
 196  	 *
 197  	 * @since 2.9.0
 198  	 *
 199  	 * @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
 200  	 */
 201  	if ( ! apply_filters( 'load_default_embeds', true ) ) {
 202  		return;
 203  	}
 204  
 205  	wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );
 206  

PHP Documentation

<?php
/**
	 * Filters whether to load the default embed handlers.
	 *
	 * Returning a falsey value will prevent loading the default embed handlers.
	 *
	 * @since 2.9.0
	 *
	 * @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/embed.php
Related Hooks

Related hooks will be displayed here in future updates.