[wp-trac] [WordPress Trac] #56694: Uncached database read for logged in users when Privacy Policy Page is deleted
WordPress Trac
noreply at wordpress.org
Thu Sep 29 21:21:57 UTC 2022
#56694: Uncached database read for logged in users when Privacy Policy Page is
deleted
-------------------------------------+-------------------------------------
Reporter: johnjamesjacoby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Privacy | Version: 5.7
Severity: normal | Resolution:
Keywords: needs-patch needs-unit- | Focuses: administration,
tests | performance
-------------------------------------+-------------------------------------
Comment (by johnjamesjacoby):
Recommend a two-part fix for this:
1. Add a method to the `WP_Privacy_Policy_Content` class to check if the
Page exists with the ID that the Setting (`wp_page_for_privacy_policy`) is
set to. If it does not exist, update the setting value to `0` and halt any
additional stuff related to it. This will self-heal the problem for
existing sites without any kind of upgrade routine, and also just seems
smart to do here.
2. Add a similar hook (likely to `wp_trash_post` and `before_delete_post`)
with a helper function to update the `wp_page_for_privacy_policy` option
to `0`. This matches what the Front Page options also do. See:
`_reset_front_page_settings_for_post()` – this requires auditing WordPress
for any existing places where the Privacy Policy Page being in the Trash
is accounted for and removing them (I found 1, in `options-privacy.php` –
may be more).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56694#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list