From 65e09425002f27c5282b2f1888531502d1310197 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Thu, 5 Feb 2026 12:04:06 +0100 Subject: [PATCH 1/2] fix: prevent repeat redirect from overriding first-time redirect The repeat-redirect block was not inside an else branch, so when redirect_repeat_page was set it would always overwrite the first-time redirect URL. Now the repeat redirect only applies to repeat commenters. Co-Authored-By: Claude Opus 4.5 --- inc/hacks.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/inc/hacks.php b/inc/hacks.php index 58d3514..f93bcee 100644 --- a/inc/hacks.php +++ b/inc/hacks.php @@ -249,10 +249,8 @@ public function comment_redirect( string $url, WP_Comment $comment ): string { */ $url = \apply_filters( 'comment_experience\redirect', $url, $comment, 'first' ); } - } - - // Only change $url when the page option is actually set and not zero. - if ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { + } elseif ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { + // Only change $url when the page option is actually set and not zero. $url = \get_permalink( (int) $this->options['redirect_repeat_page'] ); /** From c8705cc1cee054e61b2693900099f4d94b867e69 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Thu, 5 Feb 2026 12:05:42 +0100 Subject: [PATCH 2/2] style: match codebase elseif convention Co-Authored-By: Claude Opus 4.5 --- inc/hacks.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/hacks.php b/inc/hacks.php index f93bcee..cae3e74 100644 --- a/inc/hacks.php +++ b/inc/hacks.php @@ -249,8 +249,9 @@ public function comment_redirect( string $url, WP_Comment $comment ): string { */ $url = \apply_filters( 'comment_experience\redirect', $url, $comment, 'first' ); } - } elseif ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { - // Only change $url when the page option is actually set and not zero. + } + // Only change $url when the page option is actually set and not zero. + elseif ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { $url = \get_permalink( (int) $this->options['redirect_repeat_page'] ); /**