Skip to content

Instantly share code, notes, and snippets.

@rafaehlers
Created October 28, 2024 18:53
Show Gist options
  • Save rafaehlers/047969bd5bc1e7a98f9605fea19c1e93 to your computer and use it in GitHub Desktop.
Save rafaehlers/047969bd5bc1e7a98f9605fea19c1e93 to your computer and use it in GitHub Desktop.
Edit Entry: Change the action of the Cancel button to close the lightbox
<?php // DO NOT COPY THIS LINE
function custom_cancel_onclick_js( $back_link, $form, $entry, $view_id, $update_count ) {
$run_on_views = [2334]; //Change this to the IDs of the Views you'd like to run this filter [100,200,300,...]
if( in_array( $view_id, $run_on_views ) ){
return 'window.parent.postMessage({closeFancybox: true}, "*"); return false;';
}
}
add_filter( 'gravityview/edit_entry/cancel_onclick', 'custom_cancel_onclick_js', 100, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment