How to STOP a submission

I have a WP site that is calling gform_after_submission in function.php so I can do some stuff first.

eg. add_action( 'gform_after_submission', 'funcSendLeadFormToEP', 10, 2 );

This works fine. I want to now selectively stop form submissions from being saved to the database in Entries table. How do I do this? If I simply “return” right away it still submits.

function funcSendLeadFormToEP( $entry, $form )
{ return }

does not work. any idea?

Hi Ken. If you’re using gform_after_submission, the entry has already been created. If you want to do something before the entry is created, you can use gform_pre_submission, and then decide if you want to create the entry or not based on your “doing stuff”.