| 开发者 |
dsturm
zirkeldesign d.sturm |
|---|---|
| 更新时间 | 2026年11月18日 15:15 |
| PHP版本: | 8.3 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
Unofficial integration. Cap is an independent open-source project by tiagozip (https://trycap.dev/, Apache-2.0). This plugin is a third-party integration and is not affiliated with, endorsed by, or sponsored by the Cap project. "Cap" refers to that project solely to describe what this plugin works with.Features
cap_captcha_protect) to enable/disable protection on any form, even conditionally.privacy-captcha-for-cap folder to /wp-content/plugins/.No. Cap is an independent open-source project by tiagozip (https://trycap.dev/), licensed under Apache-2.0. This plugin is an unofficial third-party integration and is not affiliated with or endorsed by the Cap project. We reference the "Cap" name only to indicate which software this plugin works with.
You provision those in your self-hosted Cap server. See the Cap documentation at https://trycap.dev/.
By default: from the copies bundled inside this plugin under wp-content/plugins/privacy-captcha-for-cap/assets/wasm/. There are two: cap_wasm_bg.wasm for the classic SHA-256 challenge and hashwx.wasm for the hashwx challenge that newer Cap servers issue by default. You can optionally switch to your own Cap server's /assets/ endpoint under Settings → Privacy CAPTCHA for Cap → Privacy. Either way the files are served from your own infrastructure, and no third-party CDN is contacted.
.wasm file bundled, and where does it come from?The bundled assets/wasm/cap_wasm_bg.wasm and assets/wasm/hashwx.wasm are the WebAssembly modules the Cap widget uses to run the proof-of-work challenge in the visitor's browser. Bundling it locally is the privacy-friendly default: it means no third-party CDN (jsdelivr) is contacted at page load, so visitor IPs are never shared (DSGVO/GDPR-clean).
Both are the unmodified upstream files from the @cap.js/wasm npm package (Apache-2.0), part of the open-source Cap project. The plugin does not alter them. Its source and build live in the Cap repository at https://github.com/tiagozip/cap, and the vendoring step is reproducible via scripts/build-assets.mjs (bun run build), which copies the files verbatim and bun run build:check verifies they match upstream.
Yes. Define CAP_CAPTCHA_SECRET_KEY in wp-config.php and the plugin will use it instead of the value saved in wp_options.
When enabled, the plugin lets submissions through if the Cap server is unreachable. Off by default — only turn it on if temporary outages must not block legitimate users (logins, checkouts). It applies only when Cap genuinely can't be reached; a CAPTCHA the server actively rejects is always blocked. You can set fail-open per form (e.g. open for logins, closed for contact forms) under the global toggle, and any submission accepted this way is flagged for review (Gravity Forms entries, WooCommerce orders, comments, and new users get a cap_captcha_fail_open marker; orders also get a note).
Yes. On a multi-page form the CAPTCHA is only required on the page that shows it, or on the final submit. When a form is protected automatically, the field is placed on the last page — which on a form built with a preview step (a page break plus {all_fields}) is the preview page, right next to the submit button. If that last page can be hidden by conditional logic, place the CAPTCHA field manually on a page that always renders, or move it with the cap_captcha_gf_field_page filter — the plugin will not enforce a CAPTCHA the visitor was never shown.
cap-widget script make any external requests?No third-party CDN requests. All widget assets are bundled and served from this plugin, including the pako decompression library (assets/js/vendor/pako_inflate.min.js), which older browsers without the native DecompressionStream API load locally instead of from jsdelivr. The only network requests the widget makes are to your own Cap endpoint to fetch and verify challenges.
Yes. Every surface passes through the cap_captcha_protect filter — ($enabled, $context) returning a boolean — before the widget renders and before a submission is verified. For example, to skip the CAPTCHA for logged-in users everywhere: add_filter('cap_captcha_protect', fn($on, $ctx) => is_user_logged_in() ? false : $on, 10, 2);. There is also a per-surface filter, e.g. cap_captcha_protect_woocommerce_login. Context ids: gravity_forms, contact_form_7, fluent_forms, wpdiscuz, comments, login, registration, woocommerce_checkout, woocommerce_login, woocommerce_registration, woocommerce_lost_password.
Yes — useful for legally required or accessibility-sensitive forms. For Contact Form 7, set the mode to Manual (Settings → Form placement) and add the [cap_captcha] tag only to the forms you want protected; or, in Automatic mode, add cap_captcha: off to a form's Additional Settings to skip just that one. For Gravity Forms, each form has a Privacy CAPTCHA setting (Default / Always / Never) so you can exclude individual forms even when "protect all" is on. For Fluent Forms, only forms containing the CAPTCHA field are protected; add one field on the last step of a regular form. Conversational forms are not supported.
In Gravity Forms forms using the Orbital theme it already follows the look of your fields. Anywhere else, or to change a detail, set the widget's CSS custom properties (--cap-background, --cap-border-color, --cap-border-radius, --cap-focus-ring and others) on cap-widget or on the form. In Gravity Forms, set them on the form or the widget rather than on :root.
Yes. The main ones:
cap_captcha_protect — master gate for every surface: ($enabled, $context) returning a boolean. Runs before the widget renders and before a submission is verified.cap_captcha_protect_{context} — per-surface gate, e.g. cap_captcha_protect_woocommerce_login.cap_captcha_fail_open — ($open, $context) the resolved fail-open decision for a surface; plus a cap_captcha_fail_open_pass action when a submission is accepted via fail-open.cap_captcha_require_token — ($required, $context) return false to let a surface through when no token was submitted at all. Fail-open does not cover this case: it applies only to an unreachable Cap server.cap_captcha_gf_field_page — ($page, $form) which page the auto-injected Gravity Forms field is placed on (defaults to the last page).cap_captcha_gf_verified_ttl — ($seconds) how long a solved challenge stays valid across the pages of one multi-page Gravity Forms submission (default one hour); plus a cap_captcha_gf_skipped_hidden($formId, $fieldId) action when conditional logic hid the field and enforcement was skipped.cap_captcha_widget_src, cap_captcha_floating_src, cap_captcha_programmatic_src, cap_captcha_style_src — override the script/style URLs (return '' for the style to disable bundled CSS).cap_captcha_wasm_url, cap_captcha_hashwx_url, cap_captcha_pako_url: override the WASM / pako URLs (default to the bundled copies).cap_captcha_i18n — override the widget's data-cap-i18n-* strings.cap_captcha_floating_button_classes, cap_captcha_floating_position, cap_captcha_floating_autosubmit_src — floating-mode tweaks.cap_captcha_display_mode — override the resolved display mode for a specific Gravity Forms field.Please do not post it in an issue or the support forum. Report it privately through GitHub security advisories. We confirm receipt, fix it, and credit you in the changelog unless you prefer not to be named.
Please open an issue on GitHub or ask in the support forum.
cap_captcha_protect developer filter to control protection on any form, even conditionally.