Home / functions.php / Adjust default sizes for embedded content
  • How to Adjust default sizes for embedded content

    adjust-default-sizes-for-embedded-content

    Adding this snippet to the functions.php of your wordpress theme will let you update the default embed sizes.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    function wps_embed_size($embed_size){
        if(is_single()){
            $embed_size['height'] = 240;
            $embed_size['width']  = 380;
        }
        return $embed_size;
    }
    add_filter('embed_defaults', 'wps_embed_size');
    

    ( WordPress codex functions, hooks, in this snippet. )

    embed_defaults, is_single, add_filter, _e, wp,