Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/curtistinkers/get-main-site-name-wpplugin/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Get Main Site Name plugin
This will output the name of the main site in a WordPress Multisite setup. If not in a multisite environment, it will return the name of the current site.
Usage
Use the helper function get_main_site_name_helper() anywhere in your theme or plugin.
Example
<?php
echo get_main_site_name_helper();