Q: Custom meta from the WordPress filter 'insert_custom_user_meta' always empty I'm trying to send an automated mail to whenever a user gets 'approved' on my website. The approval is a custom user meta field with a select that's either 'yes' or 'no'. It's always set to 'no' unless the admin manually sets it to 'yes'.
To achieve this I'm trying to use the newly added filter insert_custom_user_meta. This filter is based on the insert_user_meta filter. For both filters I can't find a lot of examples online.
I have a separate function for insert_user_meta, where it neatly provides the correct array on $meta. However, after rewriting the filter to the new insert_custom_user_meta, this filter always returns an empty $custom_meta array. Below is my code snippet.
add_filter( 'insert_custom_user_meta', 'so_filter_user_meta', 1, 4);

function so_filter_user_meta( $custom_meta, $user, $update, $userdata ) {
    if ( $update !== true ) {
        return $custom_meta;
    }

    $old_meta = get_user_meta( $user->ID, 'user_activated', true);
    
    if( $old_meta != $custom_meta['user_activated'] ) {
        // mail user
    }

    return $custom_meta;
}

Seeing how new this filter is, I might have occurred a core bug, but before entering a ticket I definitely want to make sure that I'm not missing anything..
