Digits Cache Compat
Restores WordPress page caching when Digits breaks it with DONOTCACHEPAGE. | سازگاری کش دیجیتس
by WebiLoper · github.com/mhghazi82/digits-cache-compat · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mhghazi82/digits-cache-compat/archive/refs/heads/main.zipReadme
Digits Cache Compat
Restores WordPress page caching when Digits breaks it with DONOTCACHEPAGE.
Built by WebiLoper · Telegram: @webiloper · GitHub: @mhghazi82
The problem
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.
The solution
Digits Cache Compat fixes this in two layers:
1) Digits source guard (root-cause fix)
Stops Digits from defining DONOTCACHEPAGE on every front-end bootstrap and every logout link render.
This helps all page cache plugins.
2) Official cache bridges
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.
Who is this for?
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.
Features
- 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)
Supported cache plugins
| 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 |
Requirements
- WordPress 5.8+
- PHP 7.4+
- Digits
- A page cache plugin
Installation
- 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
Verify with LiteSpeed Cache
- 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
Settings explained
1) Core compatibility
- Enable compatibility — master on/off switch
- Digits source guard — recommended root-cause fix for all caches
2) Cache plugin bridges
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).
3) Safety exclusions
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=
4) Developer tools
- Admin bar decision indicator
- Optional
debug.logtracing whenWP_DEBUGis on
What stays uncached (by design)
| 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.
Developer API
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.
} );
Important notes
- 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.
Support
- Issues: GitHub Issues
- Telegram: @webiloper
- Website: webiloper.ir
Changelog
See CHANGELOG.md.
License
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
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| v1.2.0 | Jul 21, 2026 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.