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)