Skip to content

Instantly share code, notes, and snippets.

@rutger1140
Created February 20, 2013 10:55
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save rutger1140/4994751 to your computer and use it in GitHub Desktop.
Save rutger1140/4994751 to your computer and use it in GitHub Desktop.
Gravity Forms hook - disable auto scrolling to anchor after submit
// Gravity Forms anchor - disable auto scrolling of forms
add_filter("gform_confirmation_anchor", create_function("","return false;"));
@rutger1140
Copy link
Author

@jamesbryant
Copy link

Amazing! This was doing my head in. Thanks for sharing.

@jameslem
Copy link

it's not working for me right. so bad

@frnhr
Copy link

frnhr commented Aug 25, 2013

Works well!!! Woot woot!!!

@cfxd
Copy link

cfxd commented Oct 12, 2014

Simpler version:

add_filter('gform_confirmation_anchor', '__return_false');

@advancedsoftwarecanada
Copy link

Works GREAT. I put this on first line of /wp-content/plugins/gravityformsquiz/class-gf-quiz.php

// Gravity Forms anchor - disable auto scrolling of forms
add_filter("gform_confirmation_anchor", create_function("","return false;"));

@kenanfallon
Copy link

For anyone still finding this gist, you can disable the scrolling to anchor for a single form by entering the form ID. For example for form ID 5, you can use:

add_filter( 'gform_confirmation_anchor_5', '__return_false' );

@thetwopct
Copy link

You the man, what a headache :)

@nickmeagher
Copy link

Worked great for me, thanks!

@temsool
Copy link

temsool commented Jul 4, 2016

Thanks!

@Garconis
Copy link

Thanks @kenanfallon

@dompl
Copy link

dompl commented Mar 23, 2017

Thanks @kenanfallon

@nfsarmento
Copy link

Thank you @lekkerduidelijk

@tarfoot
Copy link

tarfoot commented Jul 31, 2017

Thank you @cfxd and @kenanfallon!

@mohanrangasamy
Copy link

Thanks Its working for me

kenanfallon commented on Aug 3, 2015

@ahsanismail942
Copy link

Amazing its working perfect thanks

Copy link

ghost commented Jun 8, 2019

I'm new to this PHP and have been given a website project. How do I include this code? I've put it between php tags to no avail!

I've done a contact page on a separate php file which is called using the 'include' line and the page sends mail messages but after the submit button is clicked, the page flies up to the top.....

@rutger1140
Copy link
Author

I'm new to this PHP and have been given a website project. How do I include this code? I've put it between php tags to no avail!

I've done a contact page on a separate php file which is called using the 'include' line and the page sends mail messages but after the submit button is clicked, the page flies up to the top.....

Put it in your functions.php file and you should be good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment