WORDPRESS

Screenshot API for WordPress Developers

Automate WordPress site previews, monitor plugin pages, capture WooCommerce product screenshots, and generate Open Graph images — all via REST API.

Start Free — 200 Screenshots

Why WordPress Developers Need a Screenshot API

WordPress powers over 43% of the web — millions of sites, themes, plugins, and WooCommerce stores. If you build WordPress products, you deal with screenshots constantly: theme previews, plugin demos, client site thumbnails, WooCommerce product images, and Open Graph cards for social sharing.

Doing this manually is slow and doesn't scale. SnapAPI gives WordPress developers a reliable REST API to automate every screenshot workflow. No headless browser setup in your server environment, no Puppeteer dependencies in your WordPress plugin, no manual screen captures. One API call returns a screenshot URL or binary image.

Quick Start: PHP Integration for WordPress

WordPress runs on PHP, so here's how to call SnapAPI from a WordPress plugin or theme:

<?php
function snapapi_screenshot( $url, $args = [] ) {
    $params = array_merge([
        'access_key' => defined('SNAPAPI_KEY') ? SNAPAPI_KEY : get_option('snapapi_key'),
        'url'        => $url,
        'width'      => 1280,
        'height'     => 800,
        'format'     => 'png',
        'full_page'  => 'false',
    ], $args);

    $response = wp_remote_get(
        add_query_arg($params, 'https://api.snapapi.pics/screenshot'),
        ['timeout' => 30, 'sslverify' => true]
    );

    if (is_wp_error($response)) {
        return new WP_Error('snapapi_error', $response->get_error_message());
    }

    $code = wp_remote_retrieve_response_code($response);
    if ($code !== 200) {
        return new WP_Error('snapapi_http_error', "HTTP $code from SnapAPI");
    }

    return wp_remote_retrieve_body($response); // PNG binary
}

// Usage: capture a screenshot and upload to media library
function snapapi_capture_to_media( $target_url, $post_id = 0 ) {
    $png = snapapi_screenshot($target_url);
    if (is_wp_error($png)) return $png;

    $upload = wp_upload_bits( 'screenshot-' . time() . '.png', null, $png );
    if ($upload['error']) return new WP_Error('upload_error', $upload['error']);

    $attachment = [
        'post_mime_type' => 'image/png',
        'post_title'     => 'Site Screenshot',
        'post_status'    => 'inherit',
    ];
    $att_id = wp_insert_attachment($attachment, $upload['file'], $post_id);
    require_once ABSPATH . 'wp-admin/includes/image.php';
    $metadata = wp_generate_attachment_metadata($att_id, $upload['file']);
    wp_update_attachment_metadata($att_id, $metadata);

    return $att_id;
}
?>

WooCommerce Product Screenshot Automation

WooCommerce store owners often need screenshots of competitor products, price comparison pages, or their own product pages for marketing assets. SnapAPI handles all of it.

// Capture product page screenshots for all published products
add_action('woocommerce_product_after_variable_attributes', function($loop, $variation_data, $variation) {
    $product_url = get_permalink($variation->ID);
    $screenshot_id = get_post_meta($variation->ID, '_snapapi_screenshot', true);

    if (!$screenshot_id || get_post_meta($variation->ID, '_snapapi_refresh', true)) {
        $att_id = snapapi_capture_to_media($product_url, $variation->ID);
        if (!is_wp_error($att_id)) {
            update_post_meta($variation->ID, '_snapapi_screenshot', $att_id);
            delete_post_meta($variation->ID, '_snapapi_refresh');
        }
    }
}, 10, 3);

Open Graph Image Generation for WordPress Posts

Social sharing previews make or break click-through rates. Every blog post, page, and WooCommerce product should have a custom Open Graph image. SnapAPI lets you auto-generate OG images by screenshotting a dedicated OG template page for each post.

// Hook into Yoast or RankMath OG image filter
add_filter('wpseo_opengraph_image', function($image, $presentation) {
    $post_id = get_the_ID();
    $cached = get_post_meta($post_id, '_og_screenshot_url', true);
    $cached_time = get_post_meta($post_id, '_og_screenshot_time', true);

    // Refresh OG image if post updated since last capture
    $post_modified = strtotime(get_post_modified_time('Y-m-d H:i:s', true));
    if ($cached && $cached_time > $post_modified) {
        return $cached;
    }

    // Generate new OG screenshot
    $og_template_url = home_url('/og-template/?post_id=' . $post_id);
    $params = [
        'url'    => $og_template_url,
        'width'  => 1200,
        'height' => 630,
        'format' => 'png',
        'delay'  => 500,
    ];
    $png = snapapi_screenshot($og_template_url, $params);
    if (!is_wp_error($png)) {
        $att_id = snapapi_capture_to_media($og_template_url, $post_id);
        if (!is_wp_error($att_id)) {
            $url = wp_get_attachment_url($att_id);
            update_post_meta($post_id, '_og_screenshot_url', $url);
            update_post_meta($post_id, '_og_screenshot_time', time());
            return $url;
        }
    }
    return $image;
}, 10, 2);

Theme Preview Thumbnails for Multi-Site Networks

WordPress Multisite administrators and theme marketplace developers need fresh preview thumbnails for every theme. SnapAPI makes this trivial — iterate over your sites or themes, call the API, upload to your CDN, done.

// WP-CLI command to refresh theme previews across a multisite network
if (defined('WP_CLI') && WP_CLI) {
    WP_CLI::add_command('snapapi refresh-previews', function($args, $assoc_args) {
        $sites = get_sites(['number' => 500]);
        foreach ($sites as $site) {
            switch_to_blog($site->blog_id);
            $url = get_home_url();
            $png = snapapi_screenshot($url, ['width' => 1280, 'height' => 960, 'full_page' => 'false']);
            if (!is_wp_error($png)) {
                update_option('snapapi_preview_png', base64_encode($png));
                WP_CLI::success("Captured: $url");
            } else {
                WP_CLI::warning("Failed: $url — " . $png->get_error_message());
            }
            restore_current_blog();
        }
    });
}

Pricing Built for WordPress Developers

Free tier covers most plugin development. Paid plans scale with your production usage.

Free
200/mo
Perfect for testing & dev
$19/mo
5,000/mo
Most WordPress plugins
$79/mo
50,000/mo
High-volume marketplaces
Get Your Free API Key

Monitoring WordPress Sites with Automated Screenshots

Site monitoring goes beyond uptime checks. You want to know your site looks correct, not just that it returns a 200 status code. A CSS deployment gone wrong, a plugin conflict that breaks the header, or a CDN misconfiguration that strips styles — these all pass uptime monitors but fail visual checks. SnapAPI lets you run visual monitoring alongside your standard uptime checks.

Set up a scheduled job — a cron task, a WordPress wp-cron hook, or a GitHub Actions scheduled workflow — to screenshot your critical pages every hour or every 6 hours. Store the images in S3 or your media library and compare consecutive captures for pixel-level changes. Flag anything above a 1% diff for human review.

<?php
// wp-cron monitor job registered in your plugin
add_action('snapapi_visual_monitor', 'run_visual_monitor');
register_activation_hook(__FILE__, function() {
    if (!wp_next_scheduled('snapapi_visual_monitor')) {
        wp_schedule_event(time(), 'hourly', 'snapapi_visual_monitor');
    }
});

function run_visual_monitor() {
    $pages = [
        home_url('/'),
        home_url('/shop/'),
        home_url('/checkout/'),
        home_url('/my-account/'),
    ];

    foreach ($pages as $url) {
        $png = snapapi_screenshot($url, ['width' => 1440, 'height' => 900]);
        if (is_wp_error($png)) continue;

        $key = 'snapapi_monitor_' . md5($url);
        $prev = get_option($key . '_current');
        if ($prev) {
            update_option($key . '_previous', $prev);
        }
        update_option($key . '_current', base64_encode($png));
        update_option($key . '_ts', time());
    }
}
?>

Building a WordPress Screenshot Plugin: Architecture Guide

If you are packaging SnapAPI integration into a distributable WordPress plugin, follow these architectural patterns for a professional, maintainable codebase.

Store the API key in wp_options using a settings page under Settings > SnapAPI. Never hardcode the key or store it in a theme file. Use a constants file only in must-use plugins where the environment is fully controlled.

Queue all screenshot requests through wp_cron or a dedicated async action library like Action Scheduler (used by WooCommerce). Never make synchronous HTTP requests during page load — even 2-second delays will hurt Core Web Vitals and user experience. The wp_remote_get call to SnapAPI should always happen in the background.

Cache screenshots aggressively. Use transients with TTLs matching your update frequency — hourly for monitoring, daily for portfolio thumbnails, or invalidated explicitly on post_save for OG images. Cache keys should include the URL plus a version hash so you can force-refresh by bumping the version.

For multisite networks, use get_blog_option and switch_to_blog patterns rather than global options. Each site in the network should have its own screenshot quota tracking to prevent one high-traffic site from exhausting the shared API key allocation.

WooCommerce Category Page Screenshots for Catalogs

Print catalogs and digital lookbooks require high-quality screenshots of category pages. SnapAPI supports full-page captures with custom viewports, making it straightforward to generate print-ready assets from your live WooCommerce store.

<?php
// Generate full-page screenshots of all product category pages
function snapapi_export_category_screenshots($output_dir = '/tmp/woo-catalog/') {
    @mkdir($output_dir, 0755, true);
    $terms = get_terms(['taxonomy' => 'product_cat', 'hide_empty' => true]);

    foreach ($terms as $term) {
        $url = get_term_link($term);
        $png = snapapi_screenshot($url, [
            'width'     => 1440,
            'full_page' => 'true',
            'delay'     => 1000,  // wait for lazy images
        ]);
        if (!is_wp_error($png)) {
            $file = $output_dir . sanitize_file_name($term->slug) . '.png';
            file_put_contents($file, $png);
            error_log("SnapAPI: saved category screenshot $file");
        }
    }
}

// Trigger from WP-CLI: wp eval 'snapapi_export_category_screenshots();'
?>

Performance Considerations for High-Traffic WordPress Sites

On high-traffic WordPress sites, screenshot generation must never happen on the main request path. Every SnapAPI call should be dispatched asynchronously. Use Action Scheduler for reliable async execution, wp_cron for lighter workloads, or an external queue like Redis + Sidekiq if you have that infrastructure.

Rate limit your own screenshot requests. SnapAPI handles burst traffic well, but on large catalogs you want to throttle to 2-5 requests per second to stay within your plan limits. Use usleep() or Action Scheduler rate limiting to space out bulk operations.

For sites using full-page caching (WP Rocket, W3 Total Cache, LiteSpeed Cache), always screenshot the cached URL, not the PHP-rendered version. The cached HTML is what your users see, and it may differ from the PHP output if your caching plugin performs HTML optimization.

Generating Social Proof Screenshots Automatically

Review screenshots, testimonial captures, and social proof images are powerful conversion tools. Automate their generation with SnapAPI — capture your Google Reviews page, Trustpilot listing, or G2 profile on a weekly schedule and embed fresh screenshots in your WordPress landing pages.

Use the clip parameter to crop to just the review section, hiding navigation and footer to keep the screenshot focused and clean. Combine with wp_remote_retrieve_body and wp_upload_bits to store the result in your media library automatically.

SnapAPI vs Puppeteer in WordPress: The Real Comparison

Many WordPress developers consider running Puppeteer or Playwright via a Node.js subprocess from PHP. This technically works but creates significant operational complexity: you need Node.js installed on your WordPress server, the Puppeteer process needs access to a display server or headless Chrome, and memory usage spikes with each capture.

Shared hosting environments — where most WordPress sites live — typically block subprocess execution or lack Node.js entirely. VPS environments can support it but require ongoing maintenance of the Node.js and Chromium installations. SnapAPI sidesteps all of this. It is a simple HTTPS API call from PHP, works on any hosting environment that allows outbound HTTP requests, and requires zero server-side dependencies beyond the standard WordPress HTTP API (wp_remote_get).

Get Started with SnapAPI on WordPress Today

SnapAPI offers 200 free screenshots per month — enough to build and test your WordPress integration without spending a cent. The PHP code snippets in this guide drop directly into your plugin or theme. Sign up at snapapi.pics, copy your API key, define it as SNAPAPI_KEY in wp-config.php, and your first screenshot is one function call away.

For high-volume WooCommerce stores or multisite networks, the $19/month plan (5,000 screenshots) covers most production workloads. The $79/month plan scales to 50,000 screenshots for marketplace operators and large agencies. Enterprise plans with custom limits and SLA guarantees are available on request.