From 120d7596c3d26a4bb6f90a134ad7d8e05996037c Mon Sep 17 00:00:00 2001 From: sumaisa-mou Date: Fri, 10 Feb 2023 12:56:43 +0600 Subject: [PATCH] For empty site title, set domain name as site_name. --- includes/Core/Auth/Auth.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/Core/Auth/Auth.php b/includes/Core/Auth/Auth.php index 6f2937c4..6409dd53 100644 --- a/includes/Core/Auth/Auth.php +++ b/includes/Core/Auth/Auth.php @@ -38,9 +38,18 @@ public function site( $api = '' ) { set_transient( 'wemail_validate_me_key', $key, 5 * MINUTE_IN_SECONDS ); + /** + * For empty site title, set domain name as site_name + */ + if (get_bloginfo( 'name' )) { + $site_name = get_bloginfo( 'name' ); + } else { + $site_name = explode(".", parse_url(get_bloginfo( 'url' ))['host'])[0]; + } + $data = [ 'api_key' => $api, - 'site_name' => get_bloginfo( 'name' ), + 'site_name' => $site_name, 'site_email' => get_bloginfo( 'admin_email' ), 'site_url' => untrailingslashit( site_url( '/' ) ), 'home_url' => untrailingslashit( home_url( '/' ) ),