Documentation > Developers > Filter Examples > Custom Redirect After Approval With User Email as Parameter

Custom Redirect After Approval With User Email as Parameter

Set a custom redirect target URL, after a collection has been approved. In this case we use the clients’s email address as a parameter in the URL.

function my_picu_redirect( $url ) {
    global $post;

    if ( ! empty( $_GET['ident'] ) ) {
        $email = picu_get_email_from_ident( $post->ID, sanitize_key( $_GET['ident'] ) );
    }
    else {
        $email = get_post_meta( $post->ID, '_picu_collection_email_address', true );
    }

    if ( $email ) {
        return esc_url_raw( 'https://domain.tld/?email=' . $email );
    }

    return $url;
}

add_filter( 'picu_redirect', 'my_picu_redirect' );Code language: PHP (php)

Need help?

If you couldn’t find what you were looking for and need more assistance, please get in touch with us directly and we’re happy to help.