#48014 closed defect (bug) (fixed)
Multiple _encloseme entries in postmeta table when disabling pings
Reported by: | rebasaurus | Owned by: | whyisjake |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Pings/Trackbacks | Keywords: | has-patch commit |
Focuses: | performance | Cc: |
Description
When we disable pings, this can lead to potentially hundreds of thousands rows accumulating with the _encloseme
key on the postmeta table (as it is fired on every publish_post
hook: https://github.com/WordPress/WordPress/blob/71cf332e6569f0ac2f263ce9b2168644942f5534/wp-includes/post.php#L6580) and therefore, cause performance issues on simple meta queries that are normally run on pageload:
SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (x) ORDER BY meta_id ASC
This is because the cleanup function do_all_pings()
does not run anymore on the do_pings
hook: https://github.com/WordPress/WordPress/blob/1e925a5ae3faccad31c48c810af3954d01a60f0e/wp-includes/comment.php#L2626
Attachments (2)
Change History (19)
#1
@
5 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to whyisjake
- Status changed from new to accepted
#4
@
5 years ago
@rebasaurus,
Thanks for contributing this issue, and the associated patch. To get this included in 5.3, we should look at adding some unit tests, and maybe a cleanup routine during the upgrade.
#5
@
5 years ago
Chatting with @jorbin, cleanup could be part of the upgrade routine or maybe a standalone plugin.
This ticket was mentioned in Slack in #core by whyisjake. View the logs.
5 years ago
#9
@
5 years ago
The test I added isn't passing, just wanted to share as a starting for deeper testing, or another pass on the primary function. FWIW, changing to update_post_meta()
is showing the same issue.
#10
@
5 years ago
- Keywords commit added
Ran this with @desrosj yesterday, tests are passing for him. I would love to get this committed and in beta 3.
We can utilize the 4th parameter of
add_post_meta()
to prevent duplicate entries.