Opened 5 years ago
#48442 new defect (bug)
deleting a site leaves "orphaned" user options
Reported by: | pbiron | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | |
Focuses: | multisite | Cc: |
Description
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:
- 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
- visit the dashboard of the site with
blog_id == 2
- this will create the
wp_2_dashboard_quick_press_last_post_id
user meta
- this will create the
- delete the site with
blog_id == 2
- see that
wp_2_capabilities
andwp_2_user_level
user metas have been deleted from theusermeta
table but thatwp_2_dashboard_quick_press_last_post_id
remains
Note: See
TracTickets for help on using
tickets.