Skip to content
Lesuto Render Engine

WordPress

Render Engine On
WordPress

The Render Engine plugin routes crawlers to Render Engine, checks your key and domain, and re-renders a page when you publish it. People get your site exactly as before.

Steps

Set It Up
Step By Step

  1. 01

    Install The Plugin

    Download the plugin, then in WordPress open Plugins > Add New > Upload Plugin, choose lesuto-render-engine.zip and activate it.

  2. 02

    Verify Your Domain

    In the Render Engine app, add your domain under Domains and publish the TXT record it shows. Keys only render domains verified by DNS.

  3. 03

    Add Your API Key

    Create a key under API keys in the app and paste it in Settings > Render Engine. The plugin checks the key and shows your domain status.

  4. 04

    Check It Works

    In wp-admin, hover a published page and choose View as crawler. If it has no rendered copy yet, choose Render it now and reload the view after about a minute: it shows the copy crawlers get next to what WordPress sends. After real crawlers visit, the Render column in Posts and Pages shows Rendered or Served from cache.

No Plugin Uploads? Use One File

Save this as wp-content/mu-plugins/lesuto-render-engine.php and replace YOUR_RENDER_KEY with your API key. Must-use plugins load on their own. Any failure falls through to your normal page.

wp-content/mu-plugins/lesuto-render-engine.phpPHP
<?php
/**
 * Plugin Name: Lesuto Render Engine
 * Description: Sends search, social and AI crawlers the rendered page. Everyone else gets the site as usual.
 */
if (!defined('ABSPATH')) {
    exit;
}

const LESUTO_RENDER_ENGINE = 'https://api.lesuto.com/api/v2/render-engine/render';
const LESUTO_RENDER_KEY = 'YOUR_RENDER_KEY';
const LESUTO_RENDER_CRAWLERS = '/(googlebot|bingbot|applebot|duckduckbot|yandexbot|baiduspider|oai-searchbot|chatgpt-user|gptbot|claude-searchbot|claude-user|claudebot|perplexity-user|perplexitybot|mistralai-user|duckassistbot|amazonbot|meta-externalagent|cohere-ai|youbot|facebookexternalhit|facebot|twitterbot|linkedinbot|pinterestbot|slackbot|discordbot|telegrambot|whatsapp)/i';

add_action('template_redirect', function () {
    if (is_admin() || wp_doing_ajax() || is_user_logged_in() || is_feed() || is_robots()) {
        return;
    }
    $ua = isset($_SERVER['HTTP_USER_AGENT']) ? (string) $_SERVER['HTTP_USER_AGENT'] : '';
    if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== 'GET' || !preg_match(LESUTO_RENDER_CRAWLERS, $ua)) {
        return;
    }
    // The address that connected. Behind your own proxy, define LESUTO_RENDER_CLIENT_IP_KEY as the
    // $_SERVER key it overwrites (for example 'HTTP_X_REAL_IP'); never a header visitors can send.
    $ip_key = defined('LESUTO_RENDER_CLIENT_IP_KEY') ? LESUTO_RENDER_CLIENT_IP_KEY : 'REMOTE_ADDR';
    $ip_parts = explode(',', isset($_SERVER[$ip_key]) ? (string) $_SERVER[$ip_key] : '');
    $page = (is_ssl() ? 'https://' : 'http://') . wp_parse_url(home_url(), PHP_URL_HOST) . $_SERVER['REQUEST_URI'];
    $response = wp_remote_get(LESUTO_RENDER_ENGINE, array(
        'timeout' => 18,
        'redirection' => 0,
        'headers' => array(
            'X-Render-Key' => LESUTO_RENDER_KEY,
            'X-Render-Url' => $page,
            'X-Render-Client-IP' => trim((string) end($ip_parts)),
            'User-Agent' => $ua,
        ),
    ));
    if (is_wp_error($response)) {
        return;
    }
    // Only pages Render Engine answered carry X-Render-Cache; anything else gets the WordPress page.
    $status = (int) wp_remote_retrieve_response_code($response);
    $rendered = wp_remote_retrieve_header($response, 'x-render-cache') !== '';
    if (!$rendered || (($status < 200 || $status > 299) && !in_array($status, array(301, 302, 303, 307, 308, 404, 410), true))) {
        return;
    }
    if (!defined('DONOTCACHEPAGE')) {
        define('DONOTCACHEPAGE', true);
    }
    status_header($status);
    header('Content-Type: text/html; charset=utf-8');
    header('Cache-Control: private, max-age=0');
    header('CDN-Cache-Control: no-store');
    header('Vary: User-Agent');
    $location = wp_remote_retrieve_header($response, 'location');
    if ($location) {
        header('Location: ' . $location);
    }
    echo wp_remote_retrieve_body($response);
    exit;
}, 0);

Rendered Pages
In About 15 Minutes

Install the plugin and check one page.

Set Up Render Engine on WordPress