From c33966e4014f91e895f4422ec4cf3817e267db6f Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Thu, 6 Mar 2025 10:38:40 -0500 Subject: [PATCH] Ensure term is valid before deleting term --- php/class-coauthors-plus.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php/class-coauthors-plus.php b/php/class-coauthors-plus.php index f51a5289..73374d8d 100644 --- a/php/class-coauthors-plus.php +++ b/php/class-coauthors-plus.php @@ -1118,7 +1118,9 @@ public function delete_user_action( $delete_id ): void { if ( is_object( $delete_user ) ) { // Delete term $term = $this->get_author_term( $delete_user ); - wp_delete_term( $term->term_id, $this->coauthor_taxonomy ); + if ( $term ) { + wp_delete_term( $term->term_id, $this->coauthor_taxonomy ); + } } if ( $this->is_guest_authors_enabled() ) {