Skip to content

Instantly share code, notes, and snippets.

@matheuswd
Created July 3, 2020 22:09
Show Gist options
  • Save matheuswd/34a46f0d58d5c06e1cf4d8b88f844ee4 to your computer and use it in GitHub Desktop.
Save matheuswd/34a46f0d58d5c06e1cf4d8b88f844ee4 to your computer and use it in GitHub Desktop.
<?php
function my_give_tribute_by_default() { ?>
<script>
let searchParams = new URLSearchParams(window.location.search);
// Change the parameter name here
let referrer = searchParams.has('referrer') ? searchParams.get('referrer') : '';
// Change the target variable here
jQuery("input#ffm-referrer").prop("value", referrer);
</script>
<?php }
add_action( 'give_donation_form_after_submit', 'my_give_tribute_by_default' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment