Add OG meta tags to wp head

Well You can also try by adding action inside.

function after_submission( $entry, $form ) {

    $name = $entry[2];
    $item = $entry[5];

    insert_og_in_head( $name, $item );
    add_action( "wp_head", "insert_og_in_head" );

}
add_action( "gform_after_submission", "after_submission", 10, 2 );

function insert_og_in_head( $name = NULL, $item = NULL) {

    global $post;
    if ( !is_page( 6 ) ) //if it is not a post or a page
    return;

    echo '<meta property="og:title" content="' . $name . ' lorem opossum dolor"/>';
    echo '<meta property="og:description" content="' . $item . ' lorem." />';
    echo '<meta property="og:type" content="website"/>';
}

error code: 523