Make WordPress Core

Opened 6 years ago

Last modified 8 months ago

#48901 new enhancement

WordPress multisite with subdirectories sites using the same 'Site Title'

Reported by: simpleform's profile simpleform Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3
Component: Networks and Sites Keywords:
Focuses: multisite Cc:

Description

I want to create a WordPress multisite with subdirectories sites using the same 'Site Title'.
I’ll be implementing an English version, Italian version, Spanish version, and so on.
The URL will be:
mysite.com
mysite.com/it
mysite.com/es

By clicking on 'My Sites', the sites list on the My Sites screen will show the same name. A change in the file my-sites.php may resolve this annoying problem

Instead of:

<?php
        foreach ( $blogs as $user_blog ) {
                switch_to_blog( $user_blog->userblog_id );

                echo '<li>';
                echo "<h3>{$user_blog->blogname}</h3>";

                $actions = "<a href='" . esc_url( home_url() ) . "'>" . __( 'Visit' ) . '</a>';

                if ( current_user_can( 'read' ) ) {
                        $actions .= " | <a href='" . esc_url( admin_url() ) . "'>" . __( 'Dashboard' ) . '</a>';
                }
?>

Would it possible to change as described below ?

<?php

    $site_name = array_unique(array_column($blogs, 'blogname'));

        foreach ( $blogs as $user_blog ) {
                switch_to_blog( $user_blog->userblog_id );

                echo '<li>';
                if ( count($site_name) == 1 ):
                echo "<h3>{$user_blog->siteurl}</h3>";
                else:
                echo "<h3>{$user_blog->blogname}</h3>";
                endif;

                $actions = "<a href='" . esc_url( home_url() ) . "'>" . __( 'Visit' ) . '</a>';

                if ( current_user_can( 'read' ) ) {
                        $actions .= " | <a href='" . esc_url( admin_url() ) . "'>" . __( 'Dashboard' ) . '</a>';
                }
                

Change History (1)

#1 @realloc
8 months ago

When multiple sites in a Multisite network share the same Site Title, the “My Sites” menu becomes hard to read, especially in multilingual setups.

Instead of adding conditional logic directly, I’d suggest introducing a filter, specific to the my-sites.php page. That way, developers can customize how site labels are shown in the “My Sites” list without affecting other areas like the admin bar or network admin screens, where multilingual plugins may already apply their own logic via hooks like “admin_bar_menu”.

Note: See TracTickets for help on using tickets.