| 开发者 | brokensmile.2103 |
|---|---|
| 更新时间 | 2026年11月25日 22:49 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.2 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
disable-devtool library) — detects DevTools being opened through multiple methods, not just keyboard shortcuts, and closes or redirects away from the tab/wp-json/wp/v2/…) and the RSS/Atom feeds no longer hand out the content of protected posts while Encrypt or Lazy Load is on: a short message replaces itwindow.InitContentVerify) and its PHP counterpart are reusable by other code<script>, <style>, <pre>, <select>, <svg>, and similar elements; injection rate is configurable (1–50%)/wp-content/plugins/init-content-protector directory, or install via the WordPress plugin screen.If you enable full content encryption, search engines that do not run JavaScript will not be able to see the content, and even those that do (such as Google) may not index it reliably. Only use this option if SEO visibility is not required, and test your pages (for example with the URL Inspection tool in Google Search Console) before deploying.
Yes. You can choose which post types are protected in the settings page.
Yes. Since 1.10, set Protection Scope to Only posts where protection is turned on. Nothing is protected until you switch a post on: tick Protect this post in the Content Protection box of the post editor (classic and block editor), or select several posts on the post list and use the Turn content protection on bulk action. A lock column on the post list shows which posts are protected. Only the post types chosen under Apply Protection to Post Types get the box.
In this mode every layer follows the switch: encryption, noise and keyword cloaking apply to switched-on posts only, and JavaScript Content Protection, Advanced DevTools Blocking and Anti-Screenshot Protection only load on those posts instead of on every page of the site. The switches are kept when you change the scope back, so you can move between both modes freely.
Developers can decide per post with the init_plugin_suite_content_protector_is_protected_post filter.
Yes. You can set a custom key per site for added security.
Inline embeds the decryption key directly in page HTML — simple and works everywhere, but readable via view-source. Enhanced fetches the key from a REST API endpoint after page load instead, keeping it out of cached/static HTML and working cleanly with full-page cache plugins. Neither mode makes content truly secret from a visitor running the page's own JavaScript — both are meant to raise the bar for casual scrapers, not stop a determined human.
No, intentionally. Rate-limiting by visitor IP would mean storing one database row per unique IP with no automatic cleanup — on a busy or bot-scanned site that bloats the database worse than the scraping it aims to prevent. If you need rate limiting, apply it at your server, CDN, or WAF layer.
The plugin automatically detects AMP endpoints and skips all protection there (JS injection, encryption, noise), since AMP doesn't allow the custom scripts these features rely on.
Yes, via the "Noise Injection Rate" setting (1–50% per word, default 7%). Noise is only ever inserted into plain text — never inside HTML tags or inside elements like <script>, <style>, <select>, or <svg> — so it can't corrupt markup.
Up to 1.9 every site used the same fixed list of noise class names, so a scraper could remove the noise once with that public list. Since 1.10:
init_plugin_suite_content_protector_noise_rotation filter (seconds, default one day, 0 = new names on every request; a fixed period keeps page caches and CSS optimizers stable).
WordPress builds automatic excerpts by running the post content through the same filter that applies protection, and SEO plugins use that excerpt (or run the content inside <head>) for the meta description and social cards. Up to 1.9 those got the "Please enable JavaScript" notice in Encrypt mode, or the hidden noise words and missing keywords. Since 1.10 protection is only applied to the article body itself. To protect those calls too, return false from the init_plugin_suite_content_protector_skip_secondary_content filter.
"Enable JavaScript Content Protection" is the plugin's original, lightweight protection: it blocks common keyboard shortcuts, right-click, text selection, and printing. "Advanced DevTools Blocking" adds a dedicated third-party detection library (disable-devtool) that recognizes DevTools being opened through several different methods beyond keyboard shortcuts, and reacts by closing or redirecting the tab. "Anti-Screenshot Protection" (Init AntiSnap) is a separate heuristic that watches for scroll-jump and layout-shift patterns typical of automated screenshot/scraping tools and briefly blurs the page instead. All three are independent — enable any combination that fits your site.
They're designed not to, but both are heuristic and best-effort like every other protection layer in this plugin. Advanced DevTools Blocking only reacts when it detects an open DevTools panel; Anti-Screenshot Protection only reacts to repeated, evenly spaced scroll steps made without any real input from the visitor, or DevTools-style viewport changes, and its blur effect clears itself automatically after a few seconds or as soon as the tab regains focus. Neither is enabled by default.
It's aimed at automated scraping tools built on Puppeteer, Playwright, or Selenium — the kind that run a real browser engine and read the DOM after your page renders, which the plugin's other protections (encryption, noise, keyword cloaking) can't stop on their own once the page is decrypted for them too. When enabled, it scores several client-side automation signals together (no single signal decides on its own) and, if the session looks automated, simply never triggers decryption — the content stays on its loading skeleton instead of appearing in the DOM. It only takes effect when Content Protection Mode is set to Encrypt, and it's off by default. Like every automation signal, well-configured "stealth" tooling can evade individual checks — this raises the cost of scraping, it doesn't guarantee blocking it.
Yes, since 1.11. The same goes for the listings (home page, archives, search results) when your theme prints the full content there; they are protected like a single post. Theme excerpts and SEO descriptions are left as they are on purpose (a short teaser, used by search engines and social cards; the init_plugin_suite_content_protector_skip_secondary_content filter changes that). Not covered: AMP pages (AMP does not allow the scripts this plugin needs, so the protection is switched off there), and endpoints that other plugins register themselves. With Encrypt Content or Lazy Load on, every REST endpoint that renders post content (/wp-json/wp/v2/posts, pages, custom post types, revisions and autosaves) returns a short message instead of content.rendered, and instead of an automatic excerpt (a manual excerpt is left as is). Users who can edit the post and the excluded roles still get the real content, and password-protected posts are not changed. Apps, headless front ends and plugins that read the article through the REST API will get the message; use the init_plugin_suite_content_protector_rest_hide_content filter to let a request through, and init_plugin_suite_content_protector_rest_content_message to change the text. The RSS/Atom feeds follow the same rule, and their excerpt (description) is replaced as well, a manual excerpt included.
Lazy Load (new in 1.11) is the lighter way to keep your article out of the page. The HTML is sent with a loading skeleton only. After the page has loaded, a script verifies the browser and fetches the article through the REST API, then puts it in place. Nothing is encrypted, so there is no decryption key and no Web Crypto or CryptoJS involved, and the page itself is the same for every visitor, so it caches well.
It stops anything that only reads the HTML, such as wget, curl or a basic scraper, and crawlers that do not run JavaScript. If the check fails (a network error, for example) the visitor sees a message with a Retry button instead of an endless skeleton. Keyword cloaking and noise injection still apply: their CSS is delivered together with the content, so it always matches. Like Encrypt mode it hides the content from search engines that do not run JavaScript; see the SEO question above, and test with Search Console.
Scripts inside the article are not executed (as in Encrypt mode). Plugins that need the real text can listen for the init-content-decrypted event, which Lazy Load fires too (event.detail.mode is lazy).
Before the article is sent, the request must pass these checks: it comes from a page of your site (the page's REST nonce, or the browser's Sec-Fetch-Site: same-origin header, which is also what makes pages served from a full-page cache work after the nonce has expired, or a search engine crawler confirmed by reverse DNS); the Headless Browser Detection option, if enabled, did not flag the session; and the browser holds a short-lived token that was issued at least a second earlier. The token is signed with your site's secret keys, bound to one post and valid for 5 minutes, so nothing is stored in your database.
This is a deterrent, not a captcha: a script written specifically against your site can still do the same steps. Like the rest of the plugin it raises the cost of scraping and cannot stop a determined visitor. The route is not rate-limited by the plugin, for the same reason as the Enhanced key route.
Yes. In the browser, window.InitContentVerify offers request( path, options ) (a same-site REST call that sends the nonce and retries once without it when the nonce has expired in a cached page), getToken( postId ), gate() (the Headless Browser Detection result), showNotice( element, kind, onRetry ) (the message with the Retry button), render( element, html, css ) and more. Enhanced key delivery and Lazy Load both use it. In PHP, init_plugin_suite_content_protector_verify_issue_token( $scope, $subject ) and init_plugin_suite_content_protector_verify_check_token( $token, $scope, $subject ) issue and check the signed tokens, and init_plugin_suite_content_protector_verify_request( $request, $settings ) runs the same-site check on a REST request. Developers can change the minimum wait and the lifetime of a token with the init_plugin_suite_content_protector_verify_min_age (default 1 second) and init_plugin_suite_content_protector_verify_ttl (default 300 seconds) filters.
Not on HTTPS sites. Since 1.7 decryption uses the browser's built-in Web Crypto API, which is much faster and adds no extra download. The bundled CryptoJS file (about 60 KB) is only loaded on sites not served over HTTPS (where browsers disable Web Crypto), or on demand in the rare browser without Web Crypto support. Developers can force it either way with the init_plugin_suite_content_protector_load_cryptojs filter.
It did before 1.9: Googlebot renders pages with a headless Chromium, so it can score as automation and was then only shown the loading skeleton. Since 1.9 the option Allow Verified Search Engine Crawlers (on by default) lets real search engine crawlers through. A session that looks like automation first asks your server whether the request comes from a verified crawler. The server only answers yes after a reverse DNS lookup of the request IP lands on the operator's domain (for example googlebot.com or search.msn.com) and a forward lookup of that name returns the same IP, the method Google and Bing document. The User-Agent alone is never trusted, so scrapers pretending to be Googlebot are still blocked. Supported: Google, Bing, Apple, Yandex and Baidu.
Things to check if a crawler is still blocked:
CF-Connecting-IP only when the connection really comes from Cloudflare's published IP ranges, and X-Forwarded-For / X-Real-IP only when it comes from a proxy or load balancer on a private network, so a visitor cannot forge it. The line IP address the plugin sees for you shows what is detected and should be your own public IP. If it shows a CDN or proxy address instead, pick the matching option (Cloudflare, or a proxy header such as X-Forwarded-For). The proxy header options trust that header completely: only use one when your server accepts traffic from that proxy alone./wp-json/init-content-protector/v1/crawler must be reachable for crawlers: not blocked in robots.txt, and not restricted to logged-in users by a security plugin. If the check cannot be completed, decryption stays withheld.init_plugin_suite_content_protector_verified_crawlers (crawlers and their reverse DNS domains), init_plugin_suite_content_protector_pre_crawler_dns_check (for example to compare against published IP ranges) and init_plugin_suite_content_protector_is_verified_crawler filters. Verification only matters when Headless Browser Detection is enabled in Encrypt mode.
Yes, since 1.10. Under Loading Skeleton Color Scheme choose Light (default), Dark, or Automatic, which follows the visitor's system light/dark setting (only choose it if your theme does the same). The scheme also applies to the "enable JavaScript" notice.
If your theme has its own dark mode switch, every color is a CSS custom property you can set on the .icp-protected wrapper, for example:
html.dark .icp-protected {
--icp-skeleton-bg: #2b2f36;
--icp-skeleton-shine: rgba(255, 255, 255, 0.06);
}
Available properties: --icp-skeleton-bg, --icp-skeleton-shine, --icp-skeleton-radius, --icp-skeleton-height, --icp-skeleton-gap, --icp-noscript-bg, --icp-noscript-border, --icp-noscript-color. Your rules always win over the built-in schemes. Developers can also pick the scheme per request or per post in PHP with the init_plugin_suite_content_protector_skeleton_scheme filter (return light, dark or auto), for example from the theme's dark mode cookie:
add_filter( 'init_plugin_suite_content_protector_skeleton_scheme', function ( $scheme ) {
return ( isset( $_COOKIE['theme_mode'] ) && 'dark' === $_COOKIE['theme_mode'] ) ? 'dark' : $scheme;
} );
Note: when the page is served from a full-page cache, a scheme picked per visitor in PHP is cached too; the CSS approach works with any cache.
Yes. In Encrypt mode the article first shows a loading skeleton, so scripts that scan the page on load (search term highlighting, table of contents, reading progress, lightboxes) run before the real text exists. After a block has been successfully decrypted and inserted into the page, the plugin fires an init-content-decrypted event. It works the same for Inline and Enhanced (REST API) key delivery, and it is never fired when decryption fails or is withheld (for example by Headless Browser Detection).
The event is dispatched on the element that now holds the content and bubbles, so you can listen on document or window. event.detail.element is the element holding the decrypted content and event.detail.postId is the post ID. It fires once per protected block, so register your listener early (when your script loads) rather than after the page has finished.
document.addEventListener( 'init-content-decrypted', function ( event ) {
var container = event.detail.element;
// Re-run your feature on container here.
} );
For example, the Highlight Search Terms plugin can be told to run again on this event with its own hlst_events filter:
add_filter( 'hlst_events', function ( $events ) {
$events[] = 'init-content-decrypted';
return $events;
} );
There is also an earlier init-content-payload-ready event (on window) that fires when the encrypted payload has been found, before decryption.
Init AntiSnap 6.0 only reacts to repeated, equally sized scroll steps made by script while the visitor is not touching the page. If your own code does that (an automatic page-turn feature, for example), call InitAntiSnap.trust(ms) before scrolling, or InitAntiSnap.pause() / InitAntiSnap.resume() around it.
<!--more--> tag. Password-protected posts keep their password form.content.rendered) of protected posts through /wp-json/wp/v2/posts/<id> and its siblings, bypassing every other layer. Every REST endpoint that renders post content (posts, pages, custom post types, revisions, autosaves) now returns a short message instead of the content, and of an automatic excerpt (a manual excerpt is left alone). Users who can edit the post, and the excluded roles, still get the real content; password-protected posts are unchanged. A warning about it was added to Content Protection Mode in the settings.<description> / Atom <summary>, which the "Summary" feed setting prints and which holds the whole article of a short post) of protected posts. Both now carry a short message instead, a manual excerpt included.init_plugin_suite_content_protector_rest_hide_content (opt out per post or request) and init_plugin_suite_content_protector_rest_content_message./wp-json/init-content-protector/v1/verify and required by /wp-json/init-content-protector/v1/content/<id>. Nothing is stored, so there are no new transients or options rows, and it works behind full-page caches. The browser side is window.InitContentVerify (assets/js/verify.js) and the server side is includes/verify.php; both can be reused by other code.init-content-decrypted event is also fired by Lazy Load, and event.detail.mode tells encrypt or lazy. init-content-payload-ready is fired for Lazy Load placeholders too.init_plugin_suite_content_protector_verify_min_age, init_plugin_suite_content_protector_verify_ttl.aria-hidden attribute that made noise easy to spot was removed (noise is display: none, which already hides it from screen readers). Readers see exactly the same text as before.--icp-skeleton-bg, --icp-skeleton-shine, --icp-noscript-bg...) that themes can set on .icp-protected for their own dark mode switch, and the new init_plugin_suite_content_protector_skeleton_scheme filter picks the scheme in PHP.style.css is now only loaded in Encrypt mode (loading skeleton), and the old fixed noise class rules were removed from it (about 100 selectors). Purge your page/CDN cache after updating so no page built by 1.9 is still served.<head>; the article body is protected as before. New filter: init_plugin_suite_content_protector_skip_secondary_content.init_plugin_suite_content_protector_cloudflare_ranges filter printed PHP warnings on every request.init_plugin_suite_content_protector_is_protected_post, init_plugin_suite_content_protector_noise_rotation, init_plugin_suite_content_protector_skip_secondary_content, init_plugin_suite_content_protector_skeleton_scheme.googleusercontent.com (rentable Google Cloud addresses) is deliberately not accepted./wp-json/init-content-protector/v1/crawler. The answer is never cached, so it works behind full-page caches and CDNs. Any failure (REST blocked, timeout, invalid answer) keeps decryption withheld.CF-Connecting-IP only when the connection comes from Cloudflare's published IP ranges, and X-Forwarded-For / X-Real-IP only when it comes from a proxy on a private network, so a visitor cannot forge them. You can also pick Direct connection, Cloudflare, or a proxy header (X-Forwarded-For, X-Real-IP, True-Client-IP, Fastly-Client-IP). The settings page shows the IP address the plugin currently sees for you.init_plugin_suite_content_protector_verified_crawlers, init_plugin_suite_content_protector_client_ip, init_plugin_suite_content_protector_cloudflare_ranges, init_plugin_suite_content_protector_pre_crawler_dns_check, init_plugin_suite_content_protector_is_verified_crawler.init-content-decrypted JavaScript event is now documented (see the FAQ) and easier to listen for. It is dispatched on the element that now holds the content and bubbles up, so listeners on that element, on document (including jQuery( document ).on() and plugins that watch DOM events on the document) and on window all receive it. In 1.7 it was only dispatched on window, which document listeners never saw. Works the same for Inline and Enhanced (REST API) key delivery.event.detail.element (the element holding the decrypted content) and the new event.detail.postId.Tested up to line from the plugin file header (the value is read from this readme).init_plugin_suite_content_protector_load_cryptojs.the_content early (SEO meta, excerpts), the encrypted payload could be printed there and never reach the real content area.init-content-decrypted. New filter: init_plugin_suite_content_protector_decrypt_delay.alt, href or other attributes, a keyword such as "class" can no longer corrupt the generated markup, keywords differing only in letter case get separate classes, the longest keyword wins, and noise never lands inside SVG text. About 1.7x faster.<body>. All 5.x config keys are unchanged; new window.InitAntiSnap API (trust, pause, resume, isDefending, destroy). Theme-provided window.InitAntiSnapConfig values now take precedence over the plugin's defaults.navigator.webdriver, leftover CDP/WebDriver artifacts, a software WebGL renderer, a Permissions API inconsistency, a webdriver leak through a dynamically-created iframe, and naive navigator.webdriver patch artifacts — and, if the session looks automated, simply withholds decryption instead of ever decrypting real content into the DOM for that session..pot/.po translations for the new setting. .mo intentionally not rebuilt as part of this change.disable-devtool library (MIT licensed, vendored in assets/js/disable-devtool.min.js). Unlike "Enable JavaScript Content Protection", which only blocks a fixed set of keyboard shortcuts, this actively detects DevTools being opened through several different methods and reacts by closing or redirecting away from the tab. The library's own default fallback URL is the literal string "localhost" (a dead link on a live site), so the plugin overrides it to redirect to the site's homepage instead. Fully independent of "Enable JavaScript Content Protection" — either can be used alone or together. Off by default.assets/js/init-antisnap.js). Watches for scroll-jump and DevTools-triggered viewport/resize patterns typical of automated screenshot and scraping tools, and briefly blurs the page with a translatable warning message when detected; the blur clears itself automatically after a few seconds or as soon as the tab regains focus. Off by default, independent of every other protection layer.::before rules that visually reconstruct hidden keywords) to also respect "Exclude User Roles". Previously it was the only protection layer that ignored this setting, so an excluded role's page still received the keyword-reconstruction CSS even though their content was otherwise left unprotected.ob_start()) before its early-return checks, leaving it unclosed on any front-end request with no keywords configured or no current post (i.e. most requests on most sites — archives, the homepage). Buffering is now only started once there's actually CSS to build.<label for="..."> didn't match any element id ("Enable JavaScript Content Protection" and "Inject Noise" checkboxes), which could stop browsers from autofilling correctly and broke the label/control association for assistive tech..pot and Vietnamese .po translations for all strings introduced in this release. .mo intentionally not rebuilt as part of this change.<img and src="..."), corrupting markup and breaking layout. Noise is now only ever injected into plain text runs between tags, never inside a tag itself.<script>, <style>, <pre>, <textarea>, <code>, <select>, <option>, <title>, and <svg> elements, since injecting spans there is invalid markup (breaks dropdowns, SVG rendering) or would corrupt whitespace-sensitive/non-visual content.aria-hidden="true" to noise spans as defense-in-depth (display:none already hides them from screen readers, this guards against the CSS failing to load).includes/rest-api.php): fetches the key via a REST API endpoint after page load instead of embedding it directly in page HTML. Keeps the key out of cached/static HTML and plays nicely with full-page cache plugins. Default "Inline" mode is unchanged for backward compatibility. Deliberately not rate-limited via per-IP transients — that pattern creates one wp_options row per unique visitor/bot IP with no active garbage collection, which would bloat the database far worse than the scraping it aims to prevent. Use server/CDN/WAF-level rate limiting if needed.wp_json_encode(false) producing a non-empty string.<code> tags in two settings descriptions were rendered as literal text instead of formatted code.devtools variable in content-protector.js..pot and Vietnamese .po/.mo translations for all new strings introduced in this release.decrypt.js and content-protector.js)crypto-js.min.js) strictly to encrypt mode