WordPress.org

Ready to get started?Download WordPress

Forums

Youtube Embed Size not working (1 post)

  1. serpentxx
    Member
    Posted 1 year ago #

    Hey all,

    I am trying to get every embeded youtube to be exactly 640x340
    but i can only get it to be 640 width then the height does its own thing.

    in functions.php i have used the following code

    if ( ! isset( $content_width ) ) $content_width = 640;
    if ( ! isset( $content_height ) ) $content_height = 340;

    only the top line depicting the width works.

    alternativly i tried this code

    function mycustom_embed_defaults($embed_size){
        $embed_size['width'] = 640;
        $embed_size['height'] = 340;
        return $embed_size;
    }
    add_filter('embed_defaults', 'mycustom_embed_defaults');

    But this one even ignores the width and seems to do something in between.

    So how can i get my youtube videos to be exactly 640x340 through functions.php?

Topic Closed

This topic has been closed to new replies.

About this Topic