Description
Shed Turnstile provides centralized management of Cloudflare Turnstile Site Key and Secret Key, offering a shared API for compatible plugins such as Shed Form.
Features:
- Centralized Site Key / Secret Key management
- API functions callable from other plugins
- Turnstile widget rendering helper
- Server-side token verification
API Functions
shedturn_is_configured()— Check if keys are configuredshedturn_render_widget( $args )— Return widget HTMLshedturn_verify_token( $token, $ip )— Verify a Turnstile tokenshedturn_enqueue_script()— Enqueue Cloudflare JS
日本語の説明
Shed Turnstile は Cloudflare Turnstile の Site Key / Secret Key を一元管理し、Shed Form などの対応プラグインに共通の API を提供します。
主な機能:
- Site Key / Secret Key の一元管理
- 他プラグインから呼び出せる API 関数
- Turnstile ウィジェットの描画ヘルパー
- トークンのサーバーサイド検証
Third-Party Services
This plugin connects to Cloudflare’s servers for Turnstile verification.
- Service: Cloudflare Turnstile
- Privacy Policy: https://www.cloudflare.com/privacypolicy/
- Terms of Service: https://www.cloudflare.com/website-terms/
- Data sent: Turnstile token, site key, user IP address
- When: Each time a form with Turnstile enabled is submitted
Installation
- Upload the plugin folder to
/wp-content/plugins/, or install directly through the WordPress plugin screen. - Activate the plugin through the ‘Plugins’ menu.
- Go to Settings → Shed Turnstile and enter your Cloudflare Turnstile Site Key and Secret Key.
- Compatible plugins (e.g. Shed Form) will automatically detect and use the configured keys.
FAQ
Where do I get a Turnstile Site Key and Secret Key?
Log in to your Cloudflare dashboard, navigate to Turnstile, and create a new site. The Site Key and Secret Key will be provided.
Does this plugin work standalone?
This plugin manages Turnstile keys and provides an API. To use Turnstile on your forms, you need a compatible form plugin such as Shed Form.
Is Cloudflare Turnstile free?
Yes. Cloudflare Turnstile is a free CAPTCHA alternative service.
Screenshots
Changelog
1.5.0
- Added: On a local or development environment (wp_get_environment_type), the answer of Cloudflare’s testing keys (marked with metadata.result_with_testing_key) is accepted without the host name and action checks. The testing keys never send an action and answer with the host name example.com, so forms could not be tested end to end. Production and staging are not changed: a testing key used there still fails the checks. The filter shedturn_allow_testing_key_response can turn this on or off. The log reason is ok_testing_key.
1.4.0
- Added: shedturn_render_widget() accepts an optional “action” argument (letters, digits, underscore and hyphen, up to 32 characters). It is printed as data-action on the widget, so a plugin can tell its forms apart by passing the same value to shedturn_verify_token() as $args[‘action’]. Existing callers are not affected.
1.3.0
- Security: The verification now checks the host name in Cloudflare’s answer. It must be this site’s host (the home URL or the site URL, with or without “www.”); the Host header of the request is not used, because an attacker can set it. An answer without a host name fails. The filter shedturn_allowed_hostnames adds more hosts (several domains, or Cloudflare’s test keys). The calling plugin can also pass an expected action (shedturn_verify_token( $token, $ip, array( ‘action’ => ‘…’ ) )).
- Security: The Site Key and the Secret Key can be set in wp-config.php with the constants SHEDTURN_SITE_KEY and SHEDTURN_SECRET_KEY, or with the filters shedturn_site_key and shedturn_secret_key. The settings screen then shows “set by a constant” and never shows the value, and nothing is saved in the database.
- Security: The verification request uses wp_safe_remote_post with an 8 second timeout. If the request fails, the verification fails.
- Added: The log tells apart a reused or expired token (reason token_reused), a host name that does not match (hostname_mismatch) and an action that does not match (action_mismatch).
1.2.0
- Added: The settings screen now shows a “Verification status” table with daily counts (today and the last 7 days) of passed, failed, token-missing, connection-error and missing-secret-key verifications. Counts only; no personal data is stored. Only 14 days are kept, and the data is removed when the plugin is uninstalled.
- Added: A form that submits without a Turnstile token (a bot posting directly, or a script that never ran the widget) is now counted, and recorded in the debug log when debug mode is on. Previously such submissions were rejected without any trace.
1.1.2
- Security: Client IP detection no longer trusts the
X-Forwarded-Forheader unconditionally. The header is now only used when the request demonstrably passes through a proxy (REMOTE_ADDRis a private/reserved address), and the right-most value is taken instead of the left-most one. On directly exposed servers the header is ignored entirely, which prevents visitors from spoofing their IP address. - Added: Sites behind an external CDN (Cloudflare and similar) are detected on the settings screen, with instructions for defining
SHEDTURN_TRUSTED_PROXY_HEADERinwp-config.php. - Tweak:
remoteipis no longer sent to the Cloudflare siteverify endpoint when the client IP cannot be determined. - Tweak: Declared compatibility with WordPress 7.1.
1.1.1
- Added: CSV download button for debug log.
- Added: One-click connection test on the settings page.
1.1.0
- Added: Debug log feature — record Turnstile verification results in the admin dashboard (Settings > Shed Turnstile > Debug Log tab).
1.0.7
- Confirmed compatibility with WordPress 7.0
1.0.6
- Fixed: Apply wp_unslash() to nonce field in admin settings save handler
- Added: languages/shed-turnstile.pot for translation support
1.0.5
- Fixed: Sanitize externally-supplied $ip parameter in shedturn_verify_token()
- Fixed: Remove HTTP_CLIENT_IP trust in shedturn_get_client_ip() (spoofable header)
- Fixed: Add is_array() guard on json_decode result
- Added: Screenshots section to readme.txt
1.0.4
- Added: GPL-2.0 LICENSE file
- Added: Domain Path header
- Fixed: i18n — all user-facing strings wrapped with __()
- Fixed: uninstall.php now removes legacy wsf_turnstile_* options
1.0.3
- Changed: All function, class, constant, hook, and option prefixes renamed from wst_/WST_ to shedturn_/SHEDTURN_/Shedturn_.
1.0.2
- Changed: Plugin slug

