Allscreenshots
Sign inGet an API key

Website screenshots in WordPress

Generate and display website thumbnails on your WordPress site

Integrate the Allscreenshots API with your WordPress site to automatically generate and display website screenshots. Perfect for link directories, resource pages, portfolio galleries, and affiliate sites that need visual previews of external URLs.

Connect in 4 steps

  1. 1

    Get your API key

    Sign up for Allscreenshots and grab your API key from the dashboard.

  2. 2

    Add a custom function

    Add a PHP function to your theme or a custom plugin to call the Allscreenshots API.

  3. 3

    Display screenshots

    Use a shortcode or block to display website screenshots in posts and pages.

  4. 4

    Cache results

    Use WordPress transients to cache screenshot URLs and avoid redundant API calls.

WordPress Shortcode

php
1<?php 2// Add to functions.php or a custom plugin 3function allscreenshots_shortcode($atts) { 4 $atts = shortcode_atts([ 5 'url' => '', 6 'width' => 1280, 7 'height' => 800, 8 'fullpage' => 'false', 9 ], $atts); 10 11 if (empty($atts['url'])) return ''; 12 13 $cache_key = 'screenshot_' . md5($atts['url']); 14 $screenshot_url = get_transient($cache_key); 15 16 if (!$screenshot_url) { 17 $response = wp_remote_post( 18 'https://api.allscreenshots.com/v1/screenshots', 19 [ 20 'headers' => [ 21 'X-API-Key' => SCREENSHOT_API_KEY, 22 'Content-Type' => 'application/json', 23 ], 24 'body' => wp_json_encode([ 25 'url' => $atts['url'], 26 'fullPage' => $atts['fullpage'] === 'true', 27 'responseType' => 'url', 28 'viewport' => [ 29 'width' => (int) $atts['width'], 30 'height' => (int) $atts['height'], 31 ], 32 ]), 33 ] 34 ); 35 36 $body = json_decode(wp_remote_retrieve_body($response)); 37 $screenshot_url = $body->storageUrl; 38 set_transient($cache_key, $screenshot_url, DAY_IN_SECONDS); 39 } 40 41 return sprintf( 42 '<img src="%s" alt="Screenshot of %s" loading="lazy" />', 43 esc_url($screenshot_url), 44 esc_attr($atts['url']) 45 ); 46} 47add_shortcode('screenshot', 'allscreenshots_shortcode'); 48// Usage: [screenshot url="https://example.com"]

Built for WordPress

Simple shortcode

Display screenshots anywhere with [screenshot url="..."]. No coding beyond the initial setup.

Built-in caching

WordPress transients cache screenshot URLs to minimize API calls and speed up page loads.

No plugin dependency

A lightweight function — no bloated plugin needed. Add it to your theme or a mu-plugin.

Questions

Is there a WordPress plugin for Allscreenshots?

There is no dedicated plugin yet, but the shortcode example above can be added to your theme's functions.php in minutes. It's lightweight and has no external dependencies.

How do I cache screenshots to reduce API calls?

The example uses WordPress transients with a 24-hour expiry. Adjust DAY_IN_SECONDS to control how often screenshots refresh.

Can I use this with Gutenberg blocks?

Yes. The shortcode works in Gutenberg via the Shortcode block. You can also create a custom Gutenberg block that wraps the API call.

Will this work with page builders like Elementor?

Yes. Use the shortcode widget in Elementor, Divi, or any page builder to embed screenshots.

Keep exploring

Start with one request

Free plan: 100 screenshots. No credit card.

Get an API key
  • Full-page captures
  • Popups and repeated sticky bars removed
  • Markdown, JSON and PDF output
  • Crawl a site from one URL
  • Desktop, tablet and phone in one image
  • Works in n8n, Make and Zapier
  • MCP server for AI assistants