Create automatic screenshot of any website and publish it as image in your post

If you want to display a thumbnail of a website, you would have to go to the website, print screen it or take a screenshot with a program or a browser add-on. Then you would need to modify the image, cut it to the right size and upload it to your WordPress so that you can use the screenshot in a post.

If you don’t have to take that snapshot every now and then, it won’t be a problem, but if you’re using screenshots of different websites more often, you will be happy to hear that there is an awesome function which will save you time and your nerves.

In this article, we are about to show you the complete function which creates a shortcode that you can use for taking snapshots of any web page you want.

Create automatic screenshot:

  1. Open functions.php
  2. Copy and paste the following code:
  3. function wp_webscreen($atts, $content = NULL) {
    "snap" => '',
    "url" => '',
    "alt" => 'wploop',
    "w" => '600', // width
    "h" => '450' // height
    ), $atts));
    $img = '<img alt="' . $alt . '" src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" />';
    return $img;
    add_shortcode("screen", "wp_webscreen");
  4. Change default variables in the array
  5. Save changes

This function creates a shortcode that you can easily use anywhere on your WordPress website. Whether you want to use the screenshot of a web page in a post, sidebar widget or your footer, for example, simply c/p the shortode on the right spot:

[screen url=”” alt=”wploop” w=”600″ h=”450″]

What’s great about this function is that it saves the image as dynamic URL which means that once you create a snapshot with the shortcode, it will automatically refresh itself in the future and always show the current looks of the website specified in the shortcode.

Note that you can change the parameters of the shortcode directly from it. You don’t have to modify the code in the functions.php file if you want take the snapshot of another URL or to take the snaphost in a different dimension.


Let’s say that you want to take a screenshot of Google and make it 200×400 pixels big:

[screen url=”” alt=”Google” w=”200″ h=”400″]

You can make everything even easier by saving the shortcode into a button so that you can insert it into a post by a single click of a button (LINK).


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *