The get_current_site_name() WordPress PHP function is a deprecated function that used to set the site_name
property of the $current_site
object.
Usage
$current_site_name = get_current_site_name( $current_site );
Parameters
$current_site
(WP_Network) – Required. The current site object.
More information
See WordPress Developer Resources: get_current_site_name()
Important: This function is deprecated. Use get_current_site()->site_name
instead.
Examples
Get the current site name
// Get the current site object $current_site = get_current_site(); // Get the site name using the recommended method $site_name = $current_site->site_name; // Display the site name echo "Site Name: " . $site_name;
Display site name in a heading
// Get the current site object $current_site = get_current_site(); // Get the site name using the recommended method $site_name = $current_site->site_name; // Display the site name in an H1 tag echo "<h1>" . $site_name . "</h1>";
Set the site name in the title tag
// Get the current site object $current_site = get_current_site(); // Get the site name using the recommended method $site_name = $current_site->site_name; // Set the site name in the title tag echo "<title>" . $site_name . " | Your Website</title>";
Display a welcome message with the site name
// Get the current site object $current_site = get_current_site(); // Get the site name using the recommended method $site_name = $current_site->site_name; // Display a welcome message with the site name echo "Welcome to " . $site_name . "! We hope you enjoy your visit.";
Display site name in the footer
// Get the current site object $current_site = get_current_site(); // Get the site name using the recommended method $site_name = $current_site->site_name; // Display the site name in the footer echo "<footer>© " . date("Y") . " " . $site_name . ". All rights reserved.</footer>";