How to get the ID of the entry on Edit Entry page?

Use the following function to get the currently-edited entry: gravityview()->request->is_edit_entry().

It will return false if not on the Edit Entry screen, or it will return a \GV\Entry object. Once you have the \GV\Entry object, you can use $entry->ID to get the entry ID.

Here's a sample code:

// Inside a hook during or after `init`

$entry = gravityview()->request->is_edit_entry()

if( $entry ) {
  $entry_id = $entry->ID;
}

See the method in-context.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us