[WordPress] 外掛分享: Defer for Contact Form 7

首頁 › 外掛目錄 › Defer for Contact Form 7
WordPress 外掛 Defer for Contact Form 7 的封面圖片
10+
安裝啟用
—
尚無評分
11 天前
最後更新
—
問題解決
WordPress 6.0+ PHP 7.4+ v1.2.0 上架:2026-06-30

內容簡介

Defer for Contact Form 7 外掛旨在優化 Contact Form 7 的載入性能,透過將必要的腳本移至頁面底部,減少對首次渲染的影響,並提供輕量級的反垃圾郵件功能,提升網站的使用體驗。

【主要功能】
• 將 Contact Form 7 的核心腳本移至頁面底部
• 提供兩種內建的反垃圾郵件檢查
• 支援 Google reCAPTCHA v3 與 Yandex SmartCaptcha
• 顯示被阻擋的垃圾郵件提交數據
• 無需外部服務的輕量級反垃圾郵件解決方案

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Defer for Contact Form 7」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

On every page Contact Form 7 loads its dependencies (wp-hooks, wp-i18n) and its CSS into the , blocking first paint. This plugin fixes that:

Defer CF7 core — moves wp-hooks/wp-i18n to the footer (you cannot defer them: an inline wp.i18n.setLocaleData block runs synchronously and would throw “wp is not defined”). CF7’s scripts leave the critical path.
Async CSS — the form stylesheet loads via media=print + onload-swap.

Both optimizations are idempotent and safe on every page. Strict dependency: with Contact Form 7 inactive, the plugin does nothing.
Lightweight anti-spam
Two spam checks that need no external service and add no extra requests. Both are off by default — enable them under Contact → Performance if you don’t already run another anti-spam plugin for your forms.

Honeypot field — a field hidden from visitors is added to every form; bots fill it in and the submission is marked as spam.
Time trap — submissions sent faster than a human could fill in the form (configurable, 3 seconds by default) or sent without JavaScript are marked as spam. The time is measured in the visitor’s browser, so it works with page caching.

The settings page shows how many spam submissions have been blocked.
A note on jQuery
This plugin does NOT defer jQuery — on purpose. Deferring jQuery is only safe when EVERY jQuery-dependent script on the site is also deferred or in the footer; on an arbitrary site that is not guaranteed and breaks inline scripts in the head.
Pro version
Defer for Contact Form 7 Pro adds lazy-loaded anti-spam captcha — spam protection without a PageSpeed hit. Pick one provider (they are not run at the same time):

Google reCAPTCHA v3 — score-based. api.js loads only on the first interaction with a form, so it never appears in Lighthouse/PSI. The score check is server-side; a fresh single-use token is fetched for every submission. The badge is hidden with the required Google disclaimer (GDPR-friendly); configurable score threshold and action label.
Yandex SmartCaptcha — invisible mode, no widget shown unless the visitor looks suspicious. Same lazy-loading approach, binary server-side check. A practical alternative for sites served from Russia, where Google’s services aren’t always reliable.

Pro also adds detailed spam statistics: a breakdown by reason (honeypot, time trap, captcha), a 30-day chart and a log of what bots typed into your forms. The log stores no IP addresses, cuts every value to 100 characters and keeps entries for 30 days.
The free version stays fully functional on its own.
External services
This plugin can connect to the following third-party services:

Freemius (free and Pro) — licensing, updates and the optional usage-data opt-in. Nothing is sent unless the site administrator opts in (or activates a Pro license). When enabled, it sends the site URL, WordPress/PHP/plugin versions and the administrator’s name and email. Terms, Privacy Policy.
Google reCAPTCHA v3 (Pro only, when selected and configured) — the visitor’s browser loads https://www.google.com/recaptcha/api.js on the first interaction with a form; on submit the site sends the captcha token and the visitor’s IP address to https://www.google.com/recaptcha/api/siteverify. Terms, Privacy Policy.
Yandex SmartCaptcha (Pro only, when selected and configured) — the visitor’s browser loads https://smartcaptcha.cloud.yandex.ru/captcha.js on the first interaction with a form; on submit the site sends the captcha token and the visitor’s IP address to https://smartcaptcha.cloud.yandex.ru/validate. Terms, Data processing notice.

Support
Questions, bug reports or feature requests: the plugin’s support forum on WordPress.org, or https://rowan-web.ru/en/blog/defer-for-contact-form-7/

延伸相關外掛

文章
Filter
Mastodon