Spam Shield for agencies & hosting providers

The Spam Shield WordPress plugin is great for agencies and hosting providers. You you can white-label the branding and share your APi key among your clients’ installations, with no configuration on their part.

Configure the plugin

Use the regular Spam Shield for WordPress plugin and either install it on your clients’ sites as a regular plugin, or place it in the mu-plugins folder.

Information The recommended way to deploy Spam Shield is as a regular plugin, so you’ll receive automatic updates from the Power Plugins update servers.

You can make your agency API Key available to the site in one of two ways:

Edit wp-config.php and define the SPAM_SHIELD_AGENCY_API_KEY constant, like this:

<?php

// Primary WordPress configuration
// ...
// ...

// Spam Shield: https://spamshield.cloud/
// Replace 'xxxxxx...' with your API key.
define( 'SPAM_SHIELD_AGENCY_API_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' );

/* That's all, stop editing! */

If you don’t want to edit wp-config.php, you can hook the spam_shield_agency_api_key filter.

<?php

/**
 * Spam Shield: https://spamshield.cloud/
 * This could be in your own "Must Use Plugin" (mu-plugin):
 * Replace 'xxxxxx...' with your API key.
 */

function custom_spam_shield_agency_api_key($api_key) {
	return 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
}
add_filter('spam_shield_agency_api_key', 'custom_spam_shield_agency_api_key', 10, 1);

You can verify that your API key has been picked up by Spam Shield by going to Settings > Spam Shield. You should see confirmation that we’re now working in “agency mode”

Spam Shield for WordPress in "Agency Mode"
Spam Shield for agencies

White-label the plugin

Use the spam_shield_admin_widget_logo filter to change the logo in the admin panel widget, like in this example from The Cookehouse design agency. Notice how the unbranded widget is running in regular mode and has a link to the customer’s Spam Shield account page. When running in “agency mode”, the “My Account” button is removed – the client has no access to the agency’s Spam Shield account.

Information Deploy your custom logo in a square aspect ratio with a width about 300 pixels. You can use a larger image, but it will consume unnecessary bandwidth on your client’s hosting account.

/**
 * A custom Spam Shield logo for the Cookehouse design agency.
 */
function custom_spam_shield_admin_widget_logo($logo_meta) {
	$logo_meta = array(
		'width' => 320,
		'height' => 320,
		'url' => '/wp-content/uploads/2022/06/cooke-house-website-desigb-logo-2.png',
	);

	return $logo_meta;
}
add_filter('spam_shield_admin_widget_logo', 'custom_spam_shield_admin_widget_logo', 10, 1);

You can also customise some of the labels in the plugin:

/**
 * Override the Spam Shield settings page title.
 */
function custom_spam_shield_page_title($page_title) {
	$page_title = 'Cookehouse Anti-Spam';

	return $page_title;
}
add_filter('spam_shield_page_title', 'custom_spam_shield_page_title', 10, 1);

/**
 * Override title of the menu item that links to the settings page.
 */
function custom_spam_shield_menu_title($page_title) {
	$page_title = 'Anti-Spam';

	return $page_title;
}
add_filter('spam_shield_menu_title', 'custom_spam_shield_menu_title', 10, 1);

White label filters

FilterNotes
spam_shield_admin_widget_logo
array $logo_meta
An associative array containing width, height and URL of the widget logo,
spam_shield_page_title
string $title
Change the text in the main Spam Shield settings page.
spam_shield_menu_title
string $title
Change the name of the menu item under Settings in the WP admin area.
Filters to white label Spam Shield for WordPress