Opened 6 years ago
Last modified 6 months ago
#48442 new defect (bug)
deleting a site leaves "orphaned" user options
| Reported by: |
|
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_idmedia_library_modeuser-settingsuser-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_iduser meta
- this will create the
- delete the site with
blog_id == 2 - see that
wp_2_capabilitiesandwp_2_user_leveluser metas have been deleted from theusermetatable but thatwp_2_dashboard_quick_press_last_post_idremains
Change History (1)
This ticket was mentioned in Slack in #core-multisite by realloc. View the logs.
6 months ago
Note: See
TracTickets for help on using
tickets.