| 开发者 | someguy9 |
|---|---|
| 更新时间 | 2026年10月13日 09:15 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.0 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
X-Frame-Options: SAMEORIGIN and Content-Security-Policy: frame-ancestors 'self' HTTP headers to your site's pages. They instruct web browsers to prevent other websites from embedding your site within an iframe, effectively blocking clickjacking attempts. A Content-Security-Policy your site already sends is left in place, and WordPress post embeds stay embeddable on other sites.X-Frame-Options: SAMEORIGIN and Content-Security-Policy: frame-ancestors 'self' HTTP headers to prevent clickjackingwp_anti_clickjack_allowed_origins filterfunctions.php file. It receives true or false and runs last, so you can also return false only on specific pages:
add_filter('wp_anti_clickjack', '__return_false');
To disable the clickjacking HTTP headers (X-Frame-Options and Content-Security-Policy: frame-ancestors), use this filter in your theme's functions.php file:
add_filter('wp_anti_clickjack_x_frame_options_header', '__return_false');
To let other sites put your site in a frame, add them under Settings > Anti-Clickjack, one per line. Developers can use this filter instead (it also receives the sites saved in the settings). Wildcards work for subdomains, and the frame breaking script allows the same sites:
add_filter( 'wp_anti_clickjack_allowed_origins', function ( $origins ) { $origins[] = 'https://partner.example'; $origins[] = 'https://*.example.com'; return $origins; } );
If your WordPress admin runs on a different domain than your site, that domain is allowed automatically so page builders and previews keep working.
Page builder and editor previews are detected only for logged-in users who can edit posts, so a visitor cannot switch the protection off by adding a page builder parameter to a URL.
If your server, CDN or another plugin already sends an X-Frame-Options header or a frame-ancestors policy, the plugin leaves them as they are and doesn't add its own.
/wp-content/plugins/wp-anti-clickjack directory, or install the plugin through the WordPress admin interface.No, WP Anti-Clickjack is designed to have minimal impact on your site's performance. The anti-clickjacking measures are applied efficiently without causing any significant overhead.
Yes, WP Anti-Clickjack is compatible with popular page builders and editors such as Elementor, Divi, WPBakery, Thrive Architect, and more. If you encounter any compatibility issues, please contact me for assistance.
Add its address under Settings > Anti-Clickjack, like https://partner.example (or https://*.example.com for every subdomain). Developers can use the wp_anti_clickjack_allowed_origins filter shown under Additional Details. The site is added to the frame-ancestors policy and the frame breaking script allows it too.
Go to Tools > Site Health. The plugin's check loads your homepage the way a visitor would and tells you if the headers are missing (often a page cache or CDN serving pages without them) or if more than one framing policy is sent. Click "Check from outside" there or under Settings > Anti-Clickjack to have ClickJack Test load your homepage from the internet, through any CDN or proxy, and show what it sees.
Yes, the plugin provides filters that allow you to disable the clickjacking JavaScript and the X-Frame-Options header when needed. You can use these filters in your theme's functions.php file to fine-tune the plugin's behavior.
wp_anti_clickjack_allowed_origins filter (added to the frame-ancestors policy and allowed by the frame breaking script)X-Frame-Options: DENY (or any framing header) your server or another plugin already sendswp_anti_clickjack_x_frame_options_header filter now works from your theme's functions.phpfalse from the wp_anti_clickjack filter now turns the script off for every visitor, including visitors arriving from other sitesContent-Security-Policy: frame-ancestors 'self' alongside X-Frame-Options on every supported WordPress version