From e9dab3e79d7d62a7c6acf6ea959c250311a04e12 Mon Sep 17 00:00:00 2001 From: Michael Auteri Date: Thu, 2 Dec 2021 16:02:28 -0500 Subject: [PATCH 1/2] Issue with cache key id not being deleted. --- php/class-coauthors-guest-authors.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php/class-coauthors-guest-authors.php b/php/class-coauthors-guest-authors.php index 98b6340a..ef93c883 100644 --- a/php/class-coauthors-guest-authors.php +++ b/php/class-coauthors-guest-authors.php @@ -1214,7 +1214,7 @@ public function delete_guest_author_cache( $id_or_object ) { // Delete the lookup cache associated with each old co-author value $keys = wp_list_pluck( $this->get_guest_author_fields(), 'key' ); - $keys = array_merge( $keys, array( 'login', 'post_name', 'user_nicename', 'ID' ) ); + $keys = array_merge( $keys, array( 'login', 'post_name', 'user_nicename', 'ID', 'id' ) ); foreach ( $keys as $key ) { $value_key = $key; @@ -1222,6 +1222,8 @@ public function delete_guest_author_cache( $id_or_object ) { $value_key = 'user_nicename'; } elseif ( 'login' == $key ) { $value_key = 'user_login'; + } else if ( 'id' == $key ) { + $value_key = 'ID'; } $cache_key = $this->get_cache_key( $key, $guest_author->$value_key ); From 006add500cf57d1a863e6b4a8ea6330db73d44ee Mon Sep 17 00:00:00 2001 From: Michael Auteri Date: Thu, 2 Dec 2021 16:25:52 -0500 Subject: [PATCH 2/2] Fix elseif to match rest of code. --- php/class-coauthors-guest-authors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/class-coauthors-guest-authors.php b/php/class-coauthors-guest-authors.php index ef93c883..76619d13 100644 --- a/php/class-coauthors-guest-authors.php +++ b/php/class-coauthors-guest-authors.php @@ -1222,7 +1222,7 @@ public function delete_guest_author_cache( $id_or_object ) { $value_key = 'user_nicename'; } elseif ( 'login' == $key ) { $value_key = 'user_login'; - } else if ( 'id' == $key ) { + } elseif ( 'id' == $key ) { $value_key = 'ID'; }