Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GravityView - Disable setting cookies on front-end of site
<?php
add_filter( 'gravityview_js_localization', 'gravityview_disable_frontend_cookies' );
/**
* Disable setting cookies for back links on the front-end of the site
*
* Requires GravityView 1.22.1
*
* @param array $js_localization Settings for JS, including cookie path
*
* @return array $js_localization, without cookie path
*/
function gravityview_disable_frontend_cookies( $js_localization ) {
unset( $js_localization['cookiepath'] );
return $js_localization;
}
@asiainorama
Copy link

asiainorama commented Mar 14, 2022

Please, can you explain for newbies where to add this code?
I have problems with cookies because gravity views doesn't show the changes when edit forms.
In adittion, I've installed this plugin https://github.com/katzwebservices/gv-snippets/archive/addon/2863-disable-cache.zip but doesn't solve the problem.
Thanks in advance.

@zackkatz
Copy link
Author

zackkatz commented Apr 26, 2022

@asiainorama Please check out this article for where to add code.

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