# "In Honor Of" Field for GiveWP Donations

> Adds an optional "Donate in honor or memory of" field to GiveWP forms, saves it with the donation, shows it on the donation details screen and offers an {honoree} email tag.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: givewp, donations, custom-fields
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/give-tribute-field/

## Code

```php
$wpide_label = 'Donate in honor or memory of (optional)'; // Field label.

add_action( 'give_after_donation_levels', function ( $form_id ) use ( $wpide_label ) {
    $id = 'wpide-honoree-' . (int) $form_id;
    ?>
    <p class="form-row form-row-wide wpide-give-honoree">
        <label class="give-label" for="<?php echo esc_attr( $id ); ?>"><?php echo esc_html( $wpide_label ); ?></label>
        <input type="text" class="give-input" name="wpide_honoree" id="<?php echo esc_attr( $id ); ?>" maxlength="120" autocomplete="off">
    </p>
    <?php
} );

add_action( 'give_insert_payment', function ( $payment_id ) {
    if ( empty( $_POST['wpide_honoree'] ) || ! function_exists( 'give_update_meta' ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- GiveWP verifies its own form nonce.
        return;
    }

    give_update_meta( $payment_id, 'wpide_honoree', sanitize_text_field( wp_unslash( $_POST['wpide_honoree'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification
} );

add_action( 'give_payment_view_details', function ( $payment_id ) {
    $honoree = function_exists( 'give_get_meta' ) ? give_get_meta( $payment_id, 'wpide_honoree', true ) : '';

    if ( $honoree ) {
        echo '<div class="postbox"><h3 class="hndle">' . esc_html__( 'Tribute' ) . '</h3><div class="inside"><p>' . esc_html( $honoree ) . '</p></div></div>';
    }
} );

add_action( 'give_add_email_tags', function () {
    if ( ! function_exists( 'give_add_email_tag' ) ) {
        return;
    }
    give_add_email_tag( 'honoree', __( 'The person the donation honors' ), function ( $tag_args ) {
        $payment_id = isset( $tag_args['payment_id'] ) ? (int) $tag_args['payment_id'] : 0;
        return $payment_id ? esc_html( (string) give_get_meta( $payment_id, 'wpide_honoree', true ) ) : '';
    } );
} );
```

## Notes

Use {honoree} in GiveWP email templates. Works with the legacy and multi-step form templates; forms made with GiveWP 3's visual builder have their own custom field blocks.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""In Honor Of" Field for GiveWP Donations" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
