Filter hook 'embed_defaults'

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

View Source

embed_defaults

Filter Hook
Description
Filters the default array of embed dimensions. }

Hook Information

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

Hook Parameters

Type Name Description
int[] $size { Indexed array of the embed width and height in pixels.
string $url The URL that should be embedded.

Usage Examples

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

function my_custom_filter($size, $url) {
    // Your custom filtering logic here
    return $size;
}

Source Code Context

wp-includes/embed.php:91 - How this hook is used in WordPress core
<?php
  86  	 *     @type int $0 The embed width.
  87  	 *     @type int $1 The embed height.
  88  	 * }
  89  	 * @param string $url  The URL that should be embedded.
  90  	 */
  91  	return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );
  92  }
  93  
  94  /**
  95   * Attempts to fetch the embed HTML for a provided URL using oEmbed.
  96   *

PHP Documentation

<?php
/**
	 * Filters the default array of embed dimensions.
	 *
	 * @since 2.9.0
	 *
	 * @param int[]  $size {
	 *     Indexed array of the embed width and height in pixels.
	 *
	 *     @type int $0 The embed width.
	 *     @type int $1 The embed height.
	 * }
	 * @param string $url  The URL that should be embedded.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/embed.php
Related Hooks

Related hooks will be displayed here in future updates.