X

Adjust Default Sizes for Embedded Content

Snippets by IsItWP

When you embed images in your WordPress posts and pages, they’ll have the default sizes to select and display from. You can change the default height and width for your embedded content and add a custom size of your choice.

Instructions: Add the following code to the functions.php file of your WordPress theme.
You can replace the height and width in the following code.

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');

You may also enjoy removing WordPress oEmbed related items.

Comments   Leave a Reply

  1. du lich singapore January 20, 2014 at 8:23 pm

    Nice post

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!