ClientPress exposes PHP filters that let developers extend plugin behaviour without modifying core plugin files. Add your customisations to a site-specific plugin or your theme’s functions.php.
Filters #
cp_allowed_upload_types #
Filters the list of MIME types that clients are permitted to upload — both for portal file uploads and deliverable uploads.
Signature
apply_filters( 'cp_allowed_upload_types', array $mime_types ): array
| Parameter | Type | Description |
|---|---|---|
$mime_types |
string[] |
Indexed array of MIME type strings (e.g. 'image/jpeg', 'application/pdf'). Default comes from Settings → Allowed File Types in the ClientPress admin. |
Return value: A filtered array of allowed MIME type strings.
Where it fires
includes/FileUpload.php— portal file uploadsincludes/Deliverables.php— deliverable uploads (validation + storage)
Examples
// Allow SVG uploads in addition to whatever is set in Settings.
add_filter( 'cp_allowed_upload_types', function( array $types ): array {
$types[] = 'image/svg+xml';
return $types;
} );
// Restrict to PDFs and images only, regardless of Settings.
add_filter( 'cp_allowed_upload_types', function(): array {
return [ 'application/pdf', 'image/jpeg', 'image/png', 'image/gif', 'image/webp' ];
} );
cp_max_upload_size #
Filters the maximum permitted file size (in bytes) for portal file and deliverable uploads. The default is derived from the Max Upload Size (MB) setting in the ClientPress admin.
Signature
apply_filters( 'cp_max_upload_size', int $bytes ): int
| Parameter | Type | Description |
|---|---|---|
$bytes |
int |
Maximum file size in bytes. Default is the admin setting converted from MB (setting_mb * 1024 * 1024). |
Return value: Maximum allowed file size in bytes.
Where it fires
includes/FileUpload.php— portal file uploadsincludes/Deliverables.php— deliverable uploads (validation + storage)
Examples
// Cap uploads at 5 MB regardless of the admin setting.
add_filter( 'cp_max_upload_size', function(): int {
return 5 * 1024 * 1024; // 5 MB
} );
// Double the configured limit for administrators.
add_filter( 'cp_max_upload_size', function( int $bytes ): int {
return current_user_can( 'manage_options' ) ? $bytes * 2 : $bytes;
} );
cp_webhook_sslverify #
Filters whether SSL certificate verification is performed when ClientPress dispatches outbound webhook requests. Defaults to true. Set to false only in local/staging environments with self-signed certificates — never disable in production.
Signature
apply_filters( 'cp_webhook_sslverify', bool $verify ): bool
| Parameter | Type | Description |
|---|---|---|
$verify |
bool |
Whether to verify the remote SSL certificate. Default true. |
Return value: true to verify (recommended), false to skip verification.
Where it fires
includes/Webhooks.php— every outbound webhook dispatch
Example
// Disable SSL verification on non-production environments only.
add_filter( 'cp_webhook_sslverify', function(): bool {
return wp_get_environment_type() === 'production';
} );
Notes for Developers #
- All ClientPress filters are prefixed
cp_to avoid collisions with WordPress core and other plugins. - Filters fire on
initor later — safe to use in plugins and themes. - File-related filters (
cp_allowed_upload_types,cp_max_upload_size) fire during AJAX upload handlers, so they run in the context of the logged-in client making the upload. You can useget_current_user_id()orcurrent_user_can()inside your callback to apply per-role logic.
