File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4027,6 +4027,26 @@ function _reset_front_page_settings_for_post( $post_id ) {
40274027 unstick_post ( $ post ->ID );
40284028}
40294029
4030+ /**
4031+ * Resets the Privacy Policy page ID option when the Privacy Policy page
4032+ * is deleted or trashed, to prevent uncached database queries for a
4033+ * non-existent page.
4034+ *
4035+ * @since 7.1.0
4036+ * @access private
4037+ *
4038+ * @param int $post_id The ID of the post being deleted or trashed.
4039+ */
4040+ function _reset_privacy_policy_page_for_post ( $ post_id ) {
4041+ $ post = get_post ( $ post_id );
4042+
4043+ if ( $ post && 'page ' === $ post ->post_type ) {
4044+ if ( (int ) get_option ( 'wp_page_for_privacy_policy ' ) === (int ) $ post_id ) {
4045+ update_option ( 'wp_page_for_privacy_policy ' , 0 );
4046+ }
4047+ }
4048+ }
4049+
40304050/**
40314051 * Moves a post or page to the Trash
40324052 *
You can’t perform that action at this time.
0 commit comments