Restores WordPress page caching when Digits breaks it with DONOTCACHEPAGE.
Built by WebiLoper · Telegram: @webiloper · GitHub: @mhghazi82
Digits is a popular WordPress mobile login / OTP plugin. Internally it often defines:
define( 'DONOTCACHEPAGE', true );That constant is a WordPress convention meaning “do not cache this page.”
Digits sets it in places that run far too broadly, including:
digits_login()on everywp_loadedrequest — before checking whether?login=/?logout=is even presentlogout_urlfilter — even when Digits returns the original logout URL unchanged- Footer login modals / forms — while rendering nonces in the HTML
If Digits is active and a page cache plugin respects DONOTCACHEPAGE, your entire public site can become uncacheable.
With LiteSpeed Cache you may see logs like:
❌ forced no cache [reason] DONOTCACHEPAGE const
That destroys TTFB / PageSpeed gains on otherwise cacheable pages.
Digits Cache Compat fixes this in two layers:
Stops Digits from defining DONOTCACHEPAGE on every front-end bootstrap and every logout link render.
This helps all page cache plugins.
For cache plugins that expose an override API, this plugin tells them to ignore Digits’ constant on safe public pages.
Login, logout, Digits form/account pages, and WooCommerce cart/checkout/my-account stay uncached by design.
Any WordPress site that uses:
- Digits (mobile signup / login), and
- A page cache plugin (LiteSpeed Cache, WP Rocket, W3 Total Cache, Hummingbird, Cache Enabler, WP Super Cache, WP Fastest Cache, SiteGround Speed Optimizer, Breeze, …)
If Digits made your cache “mysteriously stop working,” this plugin is for you.
- Digits source guard (fixes the
wp_loaded+logout_urlpoison) - Bridges for LiteSpeed Cache, WP Rocket, FlyingPress, W3 Total Cache, Hummingbird, Cache Enabler
- Extra help for WP Super Cache, WP Fastest Cache, SiteGround, Breeze via source guard
- Safe exclusions for Digits auth flows, Digits form pages, WooCommerce, and
wp-login.php - Custom URL exclude fragments
- Clean settings UI with help for every section
- English + Persian (FA) admin translations + RTL layout
- Developer filters
- No Digits core file patches (survives Digits updates)
| Plugin | Support level |
|---|---|
| LiteSpeed Cache | Full bridge |
| WP Rocket | Full bridge |
| FlyingPress | Full bridge |
| W3 Total Cache | Full bridge |
| Hummingbird | Full bridge |
| Cache Enabler | Full bridge |
| WP Super Cache | Helped by source guard |
| WP Fastest Cache | Helped by source guard |
| SiteGround Speed Optimizer | Helped by source guard |
| Breeze | Helped by source guard |
- WordPress 5.8+
- PHP 7.4+
- Digits
- A page cache plugin
- Download this repository as ZIP or clone it:
git clone https://github.com/mhghazi82/digits-cache-compat.git- Upload the
digits-cache-compatfolder towp-content/plugins/ - Activate Digits Cache Compat in Plugins
- Open Settings → Digits Cache Compat
- Keep defaults enabled (Compatibility + Source guard)
- Purge your page cache once
- Visit a public page as a logged-out guest and confirm cache HIT/MISS
- Open a normal public page twice while logged out
- Expect headers like
X-LiteSpeed-Cache: hitormiss - Digits login URLs (
?login=true) and WooCommerce checkout should remain uncached
- Enable compatibility — master on/off switch
- Digits source guard — recommended root-cause fix for all caches
Enable the bridge for the cache plugin you use. Leaving unused bridges on is usually harmless.
Bridges also cover late Digits defines (for example footer login modals).
Pages this plugin will not force back into cache:
- Digits form / account pages
- WooCommerce cart, checkout, my-account
wp-login.php- Custom URL fragments you list
- Always: Digits
?login=/?logout=/?lnounce=
- Admin bar decision indicator
- Optional
debug.logtracing whenWP_DEBUGis on
| Request | Behavior |
|---|---|
?login= / ?logout= / ?lnounce= |
Always uncached |
| Digits form / account pages | Uncached (default) |
| WooCommerce cart / checkout / account | Uncached (default) |
wp-login.php |
Uncached (default) |
| Custom exclude paths | Uncached |
| Admin / AJAX / REST / cron / non-GET | Uncached |
Your cache plugin’s own rules (logged-in users, cookies, private cache, excludes) still apply.
add_filter( 'digits_cache_compat_should_allow_cache', function( $allow, $reason ) {
// Return false to keep Digits' DONOTCACHEPAGE in effect.
return $allow;
}, 10, 2 );
add_filter( 'digits_cache_compat_force_nocache', '__return_true' );
add_action( 'digits_cache_compat_register_bridges', function( $bridges ) {
// Register another cache bridge.
} );- Do not globally define
DONOTCACHEPAGEasfalseearly. Some caches treat any definition as no-cache, and WooCommerce needs the constant on cart/checkout. - This plugin does not patch Digits core files.
- Not affiliated with Digits / UnitedOver or LiteSpeed Technologies.
- Issues: GitHub Issues
- Telegram: @webiloper
- Website: webiloper.ir
See CHANGELOG.md.
GPL-2.0-or-later. See LICENSE.
وقتی افزونه دیجیتس با DONOTCACHEPAGE کش سایت وردپرس را از کار میاندازد، کش صفحات را برمیگرداند.
ساختهشده توسط WebiLoper · تلگرام: @webiloper
افزونه Digits برای ورود و ثبتنام با موبایل/OTP خیلی رایج است. داخل کد آن بارها این ثابت تعریف میشود:
define( 'DONOTCACHEPAGE', true );معنی این ثابت برای افزونههای کش این است: «این صفحه را کش نکن.»
دیجیتس این کار را در جاهایی انجام میدهد که خیلی گستردهاند، از جمله:
- تابع
digits_login()روی هر درخواستwp_loaded— حتی قبل از اینکه چک کند آیا واقعاً صفحه لاگین است یا نه - فیلتر
logout_url— حتی وقتی لینک خروج را عوض نمیکند - مودال/فرم لاگین در فوتر صفحات
نتیجه: اگر LiteSpeed Cache، WP Rocket یا کش مشابهی فعال باشد، ممکن است کل سایت عمومی از کش خارج شود و سرعت افت کند.
در لاگ LiteSpeed معمولاً چنین چیزی دیده میشود:
❌ forced no cache [reason] DONOTCACHEPAGE const
سازگاری کش دیجیتس (Digits Cache Compat) مشکل را در دو لایه حل میکند:
جلوی تعریف بیمورد DONOTCACHEPAGE در هر بارگذاری صفحه و هر لینک خروج را میگیرد.
این بخش به همه افزونههای کش کمک میکند.
برای کشهایی که API دارند، روی صفحات عمومیِ امن به آنها میگوید ثابت دیجیتس را نادیده بگیرند.
صفحات لاگین/خروج دیجیتس، فرمهای دیجیتس، و سبد/تسویه/حساب ووکامرس عمداً بدون کش میمانند.
هر سایت وردپرسی که همزمان دارد:
- افزونه دیجیتس، و
- یک کش صفحه (لایتاسپید، راکت، W3TC و …)
اگر حس میکنید «کش کار نمیکند و نمیدانم چرا»، و دیجیتس نصب است، احتمالاً همین افزونه مشکل شماست.
- محافظ منبع دیجیتس
- بریج LiteSpeed، WP Rocket، FlyingPress، W3TC، Hummingbird، Cache Enabler
- کمک به WP Super Cache، WP Fastest Cache، SiteGround، Breeze از طریق محافظ منبع
- استثناهای ایمنی برای لاگین، فرم دیجیتس، ووکامرس
- مسیرهای استثنای سفارشی
- پنل تنظیمات شیک با راهنما برای هر بخش
- رابط انگلیسی + فارسی با پشتیبانی RTL
- فیلتر برای توسعهدهندگان
- بدون پچ کردن فایلهای خود دیجیتس
- ریپو را ZIP بگیرید یا کلون کنید
- پوشه
digits-cache-compatرا درwp-content/plugins/بگذارید - افزونه را فعال کنید
- بروید به تنظیمات ← سازگاری کش دیجیتس
- پیشفرضها (سازگاری + محافظ منبع) را روشن بگذارید
- یکبار کش صفحه را Purge کنید
- یک صفحه عمومی را بهعنوان مهمان باز کنید و HIT/MISS کش را چک کنید
- فعالسازی سازگاری: کلید اصلی روشن/خاموش
- محافظ منبع دیجیتس: پیشنهادی؛ اصلاح ریشهای برای همه کشها
بریج همان کشی که واقعاً استفاده میکنید را روشن کنید.
بریجها تعریفهای دیرهنگام دیجیتس (مثل مودال فوتر) را هم پوشش میدهند.
صفحاتی که این افزونه اجباراً به کش برنمیگرداند:
- صفحات فرم/حساب دیجیتس
- سبد، تسویه، حساب ووکامرس
wp-login.php- مسیرهای سفارشی شما
- همیشه:
?login=/?logout=/?lnounce=
- نمایش تصمیم در ادمینبار
- لاگ اختیاری در
debug.log
- Issues در گیتهاب: Issues
- تلگرام: @webiloper
- وبسایت: webiloper.ir
GPL-2.0-or-later