[wp-trac] [WordPress Trac] #48442: deleting a site leaves "orphaned" user options
WordPress Trac
noreply at wordpress.org
Sun Oct 27 20:15:02 UTC 2019
#48442: deleting a site leaves "orphaned" user options
--------------------------------+-----------------------------
Reporter: pbiron | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version:
Severity: normal | Keywords:
Focuses: multisite |
--------------------------------+-----------------------------
When a site/blog is deleted, whether from the Network > Sites screen or
via `wp_delete_site()`, most "per site" user options (i.e., those added
with `update_user_option()` where `$global == false`) remain in the
`usermeta` table. The `capabilities` and `user_level` ones are deleted,
but all others remain.
Core adds at least the following such user options:
* `dashboard_quick_press_last_post_id`
* `media_library_mode`
* `user-settings`
* `user-settings-time`
and plugins often add others (e.g., classic editor adds `classic-editor-
settings`).
In a large network (with many users and many sites that have been deleted)
this can result in significant bloat to the `usermeta` table.
To reproduce:
1. create a network and add at least 1 site in addition to the main site
(e.g., with `blog_id == 2`)
* can be either sub-domain or sub-directory network
2. visit the dashboard of the site with `blog_id == 2`
* this will create the `wp_2_dashboard_quick_press_last_post_id`
user meta
3. delete the site with `blog_id == 2`
4. see that `wp_2_capabilities` and `wp_2_user_level` user metas have been
deleted from the `usermeta` table but that
`wp_2_dashboard_quick_press_last_post_id` remains
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48442>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list