Strict CSP icon

Strict CSP

Strict CSP is a WordPress plugin with the following stats:

  • #11,122 Global Rank
  • 50+ active installs
  • Since 2025 1 years active

PF Score (About PF Scores)

PF Score is not a quality guarantee. It is a ranking based on available public signals.

Silver55.1
Platinum
Gold
Silver
Bronze
Low

Score Breakdown

28.3
Popularity 40% 50+ active installs
60
Reputation 35% No ratings yet
91.1
Freshness 25% Updated 3 months ago

No vulnerability history

Download Trends

Loading download data…

Vulnerabilities

No known vulnerabilities

This plugin has no records in the Wordfence Intelligence vulnerability database.

About Strict CSP

Enforces a Strict Content Security Policy on the frontend and login screen to help mitigate any XSS vulnerabilities.

This plugin enforces a Strict Content Security Policy (CSP) on the frontend and login screen. This helps mitigate cross-site scripting (XSS) vulnerabilities. The policy cannot yet be applied to the WP Admin (see #59446).

In #58664, the manual construction of script tags was eliminated from WP_Scripts and inline scripts on frontend/login screen, thanks to the helper functions which had previously been introduced in #39941. This made it possible to apply Strict CSP, as long as themes and plugins are not directly printing <script> tags. Some bundled WordPress core themes still do this incorrectly (which has been reported in Trac as #63806). For example, do not do this:

function my_theme_supports_js() {
    echo '<script>document.body.classList.remove("no-js");</script>'; // ❌
}
add_action( 'wp_footer', 'my_theme_supports_js' );

Instead, do this:

function my_theme_supports_js() {
    wp_print_inline_script_tag( 'document.body.classList.remove("no-js");' ); // ✅
}
add_action( 'wp_footer', 'my_theme_supports_js' );

So in order for scripts to execute, they must be printed using the relevant APIs in WordPress for adding scripts, including wp_enqueue_script(), wp_add_inline_script(), wp_localize_script(), wp_print_script_tag(), wp_print_inline_script_tag(), and wp_enqueue_script_module(). Otherwise, a script’s execution will be blocked and an error will appear in the console, for example:

Refused to execute inline script because it violates the following Content Security Policy directive: “script-src ‘nonce-9b539cfe47’ ‘unsafe-inline’ ‘strict-dynamic’ https: http:”. Note that ‘unsafe-inline’ is ignored if either a hash or nonce value is present in the source list.

This also blocks scripts inside of event handler attributes, such as onclick, onchange, onsubmit, and onload. As noted on MDN:

Warning: The use of event handler content attributes is discouraged. The mix of HTML and JavaScript often produces unmaintainable code, and the execution of event handler attributes may also be blocked by content security policies.

This plugin also ensures that scripts added to the page from embeds (e.g. Tweets) also get the nonce attribute added.

Ratings & Reviews

Recent Reviews

Loading reviews…

View all reviews on WordPress.org (opens in a new tab)

Changelog

0.3.2

  • Use wp_generate_password() to create CSP nonce instead of using wp_create_nonce(). Props kasparsd. (#13)

0.3.1

  • Update required PHP version to 7.2 instead of 8.1.

0.3.0

  • Add nonce attributes to scripts added by embeds.

0.2.0

  • Disable Strict CSP from Site Editor.
  • Restrict policy to frontend and login screen.

0.1.0

  • Initial release.

Alternatives to Strict CSP

Other WordPress plugins serving a similar purpose, ranked by relevance and PF Score.

Platinum98.7
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) icon

Really Simple Security

Hardens WordPress security with two-factor authentication, login protection, and vulnerability detection across 3 million active sites.

★ 4.9/5·3.0M+ installs·Updated 27 Jul 2026
Platinum98.3
Limit Login Attempts Security – Login Security, 2FA, Firewall, Brute Force Prevention icon

Limit Login Attempts Security

Defends WordPress logins with brute force protection, two-factor authentication, and IP blocking.

★ 4.8/5·1.0M+ installs·Updated 12 Aug 2026
Platinum98.0
Loginizer icon

Loginizer

Protects WordPress login pages from brute force attacks through automated threat detection and blocking.

★ 4.8/5·1.0M+ installs·Updated 3 Aug 2026
Platinum97.6
Wordfence Security – Firewall, Malware Scan, and Login Security icon

Wordfence Security

Firewall, malware scanner, and two-factor authentication for WordPress site security.

★ 4.7/5·5.0M+ installs·Updated 10 Aug 2026
Platinum96.9
ManageWP Worker icon

ManageWP Worker

Centralized dashboard for managing, backing up, and securing multiple WordPress sites simultaneously.

★ 4.6/5·1.0M+ installs·Updated 18 Aug 2026
Platinum95.5
Kadence Security – Password, Two Factor Authentication, and Brute Force Protection icon

Kadence Security

Adds login security, two-factor authentication, vulnerability scanning, and firewall protection to WordPress sites.

★ 4.6/5·700K+ installs·Updated 27 Jul 2026
Platinum95.5
MainWP Child – Securely Connects to the MainWP Dashboard to Manage Multiple Sites icon

MainWP Child

Connects multiple WordPress sites to a centralized self-hosted dashboard for management and monitoring.

★ 5/5·700K+ installs·Updated 5 Aug 2026
Platinum93.2
Safe SVG icon

Safe SVG

Enables SVG uploads while sanitizing files to prevent XML and vector-based security vulnerabilities.

★ 4.9/5·1.0M+ installs·Updated 14 Apr 2026
Platinum92.3
User Role Editor icon

User Role Editor

Edit, add, and delete WordPress user roles and capabilities through an admin interface.

★ 4.5/5·700K+ installs·Updated 21 May 2026
Platinum91.5
NinjaFirewall (WP Edition) – Advanced Security Plugin and Firewall icon

NinjaFirewall (WP Edition)

Web application firewall designed to protect WordPress sites from malware and security threats.

★ 4.9/5·100K+ installs·Updated 16 Aug 2026