Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/embed defaults


Filters the default array of embed dimensions.

The width defaults to the content width as specified by the theme. If the theme does not specify a content width, then 500px is used. The default height is 1.5 times the width, or 1000px, whichever is smaller.

The 'embed_defaults' filter can be used to adjust either of these values.

<?php add_filter( 'embed_defaults', 'filter_function_name' ) ?>


(int) (required) Width of the embed in pixels.
Default: None
(int) (required) Height of the embed in pixels.
Default: None
(string) (required) The URL that should be embedded.
Default: None


Added to your child themes functions.php file, you can modify the default embed dimensions.

add_filter( 'embed_defaults', 'modify_embed_defaults' );
function modify_embed_defaults() {
    return array(
        'width'  => 750, 
        'height' => 375

Source File

embed_defaults is located in wp-includes/media.php


Embeds: wp_oembed_add_provider(), wp_oembed_remove_provider(), wp_oembed_get(), wp_embed_defaults(), wp_embed_register_handler(), wp_embed_unregister_handler(), get_embedded_audio(), get_embedded_media(), get_embedded_video(), wp_embed_handler_audio(), wp_embed_handler_video()