Skip to content

Commit

Permalink
Fix edit entry not working
Browse files Browse the repository at this point in the history
Request::is_edit_entry() is expected to return an entry if
it is indeed an edit entry screen.
  • Loading branch information
mrcasual committed May 30, 2024
1 parent a287711 commit 0870858
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down

0 comments on commit 0870858

Please sign in to comment.