Opened 3 years ago
Last modified 4 weeks ago
#58795 new defect (bug)
Multisite Network Admin Sites - Search doesn't work well
| Reported by: | paulpleasant | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Networks and Sites | Version: | |
| Severity: | normal | Keywords: | needs-patch needs-unit-tests |
| Cc: | Focuses: | multisite |
Description
The built-in Search functionality in the Multisite Network Admin area has not been working well. Whenever I update a Site Name on a Subsite to be the unique Subdomain, the Search box does not seem to index or cache the new Site Name (even after I clear the cache on the network). So the only way to find sites on my multisite network is to browse through hundreds of site domains until I find the one I am looking for. If I know the Site ID, I can input it into the Search box and the site comes right up. For some reason, text from the subdomain in the Site Name field do not seem to get searched through.
Change History (4)
#2
@
3 years ago
Hi @eadumbire - no, I do not have a plan or fix. I've also gone into phpMyAdmin to find subsites to get their Site ID. If I search for the Site ID on the Network Sites page, then the site comes up (but you have to know the Site ID first). If you have a solution, you're welcome to work on it. Thank you!
#3
@
4 weeks ago
- Keywords needs-patch needs-unit-tests added
Still reproducible in trunk. The cause is structural rather than a caching problem, which is why clearing the cache had no effect.
The site name is not stored in wp_blogs. That table only holds domain and path, and the primary column of the list table, despite being named blogname internally, is labelled "URL" and renders domain . path. The actual site title only appears in excerpt mode, where column_blogname() calls switch_to_blog() and reads get_option( 'blogname' ) per site. So the name is never part of the query that builds the list.
WP_Site_Query matches this: search columns are reduced to domain and path, and WP_MS_Sites_List_Table::prepare_items() narrows this further to path alone on subdirectory installs. Numeric input is routed to $args['ID'], which explains why searching by site ID works while searching by name does not.
A fix would need to decide where the name comes from. Two options come to mind:
- Resolve matching blog IDs from the site names first, for example by querying the relevant options tables or by maintaining a lookup, then pass them to the query as
site__in. This works without a schema change but does not scale well on large networks. - Store or mirror the site name in a queryable place, such as
wp_blogmeta, and extendWP_Site_Queryto search it. This scales, but it introduces a sync concern wheneverblognamechanges.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I have encountered this also. "Search Sites" option is terrible. Does not match even when the searched term is an exact match for a subsite's URL or site name.
I've largely given up on "Search Sites" and instead search the database
wp blogstable for the domain and then put theblog_iddirectly in the browser address siteidparam./wp-admin/network/site-info.php?id=6
@paulpleasant did you have plans to put forward a fix/solution? If not, I'd be willing on working on this.😉