Filters, actions and constants a site or another plugin can use to change how Consepo for WordPress behaves.
Filters
Reference
7 fields
Filters
Each receives the arguments listed and returns the first one, changed or not.
-
consepo_csp_scanner_api_urlstring -
The Consepo origin, without a trailing slash. Receives the value of CONSEPO_CSP_SCANNER_API_URL when it is defined.
-
consepo_csp_scanner_send_policyboolean -
Whether to send the header on this request. Second argument: the header as an array with name and value.
-
consepo_csp_scanner_policy_directivesarray -
Directive name => list of sources, just before the policy is serialised, after the nonce and report-uri are added. Second argument: the settings. Also shapes the Header preview.
-
consepo_csp_scanner_asset_basesarray -
Base URL => directory pairs that local assets may be hashed from.
-
consepo_csp_scanner_pre_api_requestany -
Return an array (a decoded response body) or a WP_Error to skip a Consepo API request. Further arguments: method, path, JSON body. Used by tests and local mocks.
-
consepo_csp_scanner_oauth_scopestring -
The space-separated scope requested when signing in with Consepo.
-
consepo_csp_scanner_oauth_client_idstring -
A pre-registered OAuth client id, for a Consepo that does not offer dynamic client registration. Second argument: the redirect URI.
No fields match this filter.
consepo_csp_scanner_send_policy and consepo_csp_scanner_policy_directives run on send_headers, before WordPress runs the main query, so conditional tags such as is_page() are not available yet. Decide from the request, as in the example below.
The plugin also honours core's https_local_ssl_verify filter for the Check home page loopback request.
<?php// Send no policy under /checkout/. This runs on send_headers, before the// main query, so decide from the request rather than is_page() or is_checkout().add_filter( 'consepo_csp_scanner_send_policy', static function ( bool $send ): bool { $path = (string) wp_parse_url( $_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH ); return $send && ! str_starts_with( $path, '/checkout/' ); });// Allow a payment provider's frames. Start from default-src when frame-src is// missing, or the new directive would allow only this one host.add_filter( 'consepo_csp_scanner_policy_directives', static function ( array $directives ): array { $frames = $directives['frame-src'] ?? $directives['default-src'] ?? []; $directives['frame-src'] = array_merge( $frames, [ 'https://js.stripe.com' ] ); return $directives; });
Actions
| Action | Arguments | Fires |
|---|---|---|
consepo_csp_scanner_ready | The Bootstrap instance | On plugins_loaded, once every controller has registered its hooks |
consepo_csp_scanner_activated | None | After activation has stored the defaults and scheduled the refresh |
Constants
| Constant | Set by | Purpose |
|---|---|---|
CONSEPO_CSP_SCANNER_API_URL | You, in wp-config.php | Use a staging or local Consepo origin instead of https://consepo.com |
CONSEPO_CSP_SCANNER_VERSION | The plugin | The installed version |
CONSEPO_CSP_SCANNER_FILE, CONSEPO_CSP_SCANNER_PATH, CONSEPO_CSP_SCANNER_URL, CONSEPO_CSP_SCANNER_BASENAME | The plugin | The main file, its directory and URL, and its plugin basename |
consepo_csp_scanner_version() returns the installed version, or 0.0.0 when the plugin has not booted.