Using WordPress ‘make_ham_blog’ PHP action

The make_ham_blog WordPress PHP action fires when the ‘spam’ status is removed from a site.

Usage

add_action('make_ham_blog', 'my_custom_function', 10, 1);

function my_custom_function($site_id) {
  // your custom code here

}

Parameters

  • $site_id: int – Site ID

More information

See WordPress Developer Resources: make_ham_blog

Examples

Restore site content

Restore site content when the spam status is removed.

add_action('make_ham_blog', 'restore_site_content', 10, 1);

function restore_site_content($site_id) {
  // Retrieve site content from backup
  // Restore site content
}

Send notification to site admin

Send an email notification to the site administrator when the spam status is removed.

add_action('make_ham_blog', 'send_admin_notification', 10, 1);

function send_admin_notification($site_id) {
  // Get site admin email
  // Send email notification
}

Log spam removal

Log the removal of the spam status in a custom log file.

add_action('make_ham_blog', 'log_spam_removal', 10, 1);

function log_spam_removal($site_id) {
  // Log spam status removal
}

Update site statistics

Update custom site statistics when the spam status is removed.

add_action('make_ham_blog', 'update_site_statistics', 10, 1);

function update_site_statistics($site_id) {
  // Update custom site statistics
}

Reset site reputation

Reset site reputation when the spam status is removed.

add_action('make_ham_blog', 'reset_site_reputation', 10, 1);

function reset_site_reputation($site_id) {
  // Reset site reputation score
}