From d94899099c492d593ea3ded3eb3008bb05d93d6a Mon Sep 17 00:00:00 2001 From: Paul Kevan <2290623+pkevan@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:03:47 +0000 Subject: [PATCH] Add check to is_wordcamp_closed When a `get_wordcamp_post()` cannot find a post, it return false, which then breaks the check against `post_status` - this stops that happening, and should also allow testing of tickets (when there is no post on central.wordcamp.org). --- public_html/wp-content/plugins/camptix/camptix.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index f28a1164f..791f92599 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -8584,6 +8584,10 @@ public function tmp( $key, $value = null ) { */ public function is_wordcamp_closed() { $wordcamp = get_wordcamp_post(); + // get_wordcamp_post() returns false if no post exists, so avoid breaking by returning here since it is not explicitly closed. + if ( false === $wordcamp ) { + return false; + } return 'wcpt-closed' === $wordcamp->post_status; }