From 6df14680cf9b75d471733effe013827e52296773 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sun, 12 May 2019 18:46:27 -0700
Subject: [PATCH] Allow filter to short-circuit redirect

---
 inc/class-eth-redirect-to-latest-post.php | 6 +++++-
 languages/eth-redirect-to-latest.pot      | 6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/inc/class-eth-redirect-to-latest-post.php b/inc/class-eth-redirect-to-latest-post.php
index 350d14a..721ab46 100644
--- a/inc/class-eth-redirect-to-latest-post.php
+++ b/inc/class-eth-redirect-to-latest-post.php
@@ -194,10 +194,14 @@ class ETH_Redirect_To_Latest_Post {
 		 * @param array         $redirect Array of redirect destination and status code.
 		 * @param array|WP_Post $latest   Post object or empty array if no posts found.
 		 * @param WP            $r        WP object.
-		 * @return string
+		 * @return array|null
 		 */
 		$redirect = apply_filters( 'eth_redirect_to_latest_post_redirection', $redirect, $latest, $r );
 
+		if ( null === $redirect ) {
+			return null;
+		}
+
 		return (object) $redirect;
 	}
 
diff --git a/languages/eth-redirect-to-latest.pot b/languages/eth-redirect-to-latest.pot
index bd4bc29..d4b5c6d 100644
--- a/languages/eth-redirect-to-latest.pot
+++ b/languages/eth-redirect-to-latest.pot
@@ -5,7 +5,7 @@ msgstr ""
 "Project-Id-Version: ETH Redirect to Latest Post 0.3\n"
 "Report-Msgid-Bugs-To: "
 "https://wordpress.org/support/plugin/eth-redirect-to-latest\n"
-"POT-Creation-Date: 2019-05-13 01:31:41+00:00\n"
+"POT-Creation-Date: 2019-05-13 01:45:54+00:00\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -34,11 +34,11 @@ msgstr ""
 msgid "latest"
 msgstr ""
 
-#: inc/class-eth-redirect-to-latest-post.php:235
+#: inc/class-eth-redirect-to-latest-post.php:239
 msgid "&quot;Latest post&quot; slug"
 msgstr ""
 
-#: inc/class-eth-redirect-to-latest-post.php:249
+#: inc/class-eth-redirect-to-latest-post.php:253
 #. translators: 1. Default slug, wrapped in a <code> tag.
 msgid ""
 "Set the slug that will redirect to the latest published post. The default "
-- 
GitLab