Using WordPress ‘delete_site_email_content’ PHP filter

The delete_site_email_content WordPress PHP filter allows you to modify the text for the email sent to the site admin when a request to delete a site in a Multisite network is submitted.

Usage

add_filter( 'delete_site_email_content', 'your_custom_function_name' );

function your_custom_function_name( $content ) {
  // your custom code here

  return $content;
}

Parameters

  • $content (string) – The original email text.

More information

See WordPress Developer Resources: delete_site_email_content

Examples

Add a custom message to the email

Add a custom message to the email text sent to the site admin.

add_filter( 'delete_site_email_content', 'add_custom_message_to_email' );

function add_custom_message_to_email( $content ) {
  $custom_message = "Please note: All data will be permanently deleted.";
  $content .= "\n\n" . $custom_message;

  return $content;
}

Change the email content completely

Replace the default email text with a completely new message.

add_filter( 'delete_site_email_content', 'change_email_content' );

function change_email_content( $content ) {
  $new_content = "Your request to delete the site has been submitted. Please follow the instructions sent to your email to confirm the deletion.";
  return $new_content;
}

Add a contact email for support

Add a support email address to the email text for further assistance.

add_filter( 'delete_site_email_content', 'add_support_email' );

function add_support_email( $content ) {
  $support_email = "For any questions or assistance, please contact [email protected].";
  $content .= "\n\n" . $support_email;

  return $content;
}

Include the site URL in the email text

Include the site URL that is being deleted in the email text.

add_filter( 'delete_site_email_content', 'include_site_url' );

function include_site_url( $content ) {
  $site_url = "The site URL is: " . site_url();
  $content .= "\n\n" . $site_url;

  return $content;
}

Add a custom signature to the email

Add a custom signature to the email text.

add_filter( 'delete_site_email_content', 'add_custom_signature' );

function add_custom_signature( $content ) {
  $signature = "\n\nBest regards,\nYour Friendly Support Team";
  $content .= $signature;

  return $content;
}