If you’re running a large NFP site with a donation feature from GiveWP donations and want to know how to find which page the donation was made from, they have a simple function that adds a ‘URL of Donation Submission’ area in the donation details page:

/**
 * Display the Current URL of the Donation Form from which the donation was submitted from.
 *
 * @param int $payment_id
 */
function my_give_customer_display_current_url( $payment_id ) {

	// Bounce out if no data for this transaction
	$current_url = get_post_meta( $payment_id, '_give_current_url', true );

	if ( $current_url ) : ?>

		<p>
			<strong>URL of Donation Submission:</strong><br>
			<a href="<?php echo esc_url( $current_url ); ?>"><?php echo esc_url( $current_url ); ?></a>
		</p>

	<?php endif;

}

add_action( 'give_payment_view_details', 'my_give_customer_display_current_url', 10, 2 );

Just add this in the wordpress theme’s functions.php file and you’ll get the details in the donation info area.

Since GiveWP saves the details in the give_donationmeta table, old donations will also show this info.

Leave a Comment

Your email address will not be published. Required fields are marked *