Using WordPress ‘network_sites_updated_message_{$action}’ PHP filter

The network_sites_updated_message_{$action} WordPress PHP filter allows you to modify a specific, non-default, site-updated message in the Network admin.

Usage

add_filter('network_sites_updated_message_my_custom_action', 'my_custom_update_message', 10, 1);

function my_custom_update_message($msg) {
  // your custom code here
  return $msg;
}

Parameters

  • $msg (string): The update message. Default is ‘Settings saved’.

More information

See WordPress Developer Resources: network_sites_updated_message_{$action}

Examples

Customize the message after adding a new site

In this example, we’ll customize the message displayed after adding a new site.

add_filter('network_sites_updated_message_added', 'my_added_site_message', 10, 1);

function my_added_site_message($msg) {
  $msg = "New site successfully added!";
  return $msg;
}

Customize the message after archiving a site

In this example, we’ll customize the message displayed after archiving a site.

add_filter('network_sites_updated_message_archived', 'my_archived_site_message', 10, 1);

function my_archived_site_message($msg) {
  $msg = "Site successfully archived.";
  return $msg;
}

Customize the message after unarchiving a site

In this example, we’ll customize the message displayed after unarchiving a site.

add_filter('network_sites_updated_message_unarchived', 'my_unarchived_site_message', 10, 1);

function my_unarchived_site_message($msg) {
  $msg = "Site successfully unarchived.";
  return $msg;
}

Customize the message after deleting a site

In this example, we’ll customize the message displayed after deleting a site.

add_filter('network_sites_updated_message_deleted', 'my_deleted_site_message', 10, 1);

function my_deleted_site_message($msg) {
  $msg = "Site successfully deleted.";
  return $msg;
}

Customize the message after activating a theme

In this example, we’ll customize the message displayed after activating a theme on a site.

add_filter('network_sites_updated_message_theme_enabled', 'my_theme_enabled_message', 10, 1);

function my_theme_enabled_message($msg) {
  $msg = "Theme successfully activated!";
  return $msg;
}