From 087085866a9c59006942b62049a9e5daa4dacec3 Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 30 May 2024 08:16:07 -0400 Subject: [PATCH] Fix edit entry not working Request::is_edit_entry() is expected to return an entry if it is indeed an edit entry screen. --- src/Request.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Request.php b/src/Request.php index d135959..e92823c 100644 --- a/src/Request.php +++ b/src/Request.php @@ -114,18 +114,16 @@ public function is_entry( $form_id = 0 ) { * * @param int $form_id The form ID, since slugs can be non-unique. Default: 0. * - * @return bool Yes? + * @return Entry|false The entry requested or false. */ public function is_edit_entry( $form_id = 0 ) { - if ( ! $this->is_entry( $form_id ) ) { - return false; - } + $entry = $this->is_entry( $form_id ); - if ( empty( $_GET['edit'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended + if ( ! $entry ) { return false; } - return true; + return ! empty( $_GET['edit'] ) ? $entry : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended } /**