Insert a link to a pdf file stored in a custom field

Hi ! I have a custom field (Metabox) that contains a file. In this field, it’s an array that is stored, so to retrieve the url, I have to select my first file and get the url : $file[0][“url”];
I want to insert this URL in the URL field into a loop.
Inserting directly the Metabox field doesn’t work, I tried {mb_my_field_with_pdf_file} or {mb_my_field_with_pdf_file:url}.
I tried to do it with a custom shortcode, but in a URL field, the shortcode is not interpreted directly…
What’s the best method to insert a dynamic URL from a field that contains an array ?
Thanks !

add code in function.php (or use plugin Code Snippets – WordPress plugin | WordPress.org)

function linka() {
	$val = rwmb_get_value( 'file_tw4bbasxfp');
	$val = array_shift($val);
	return $val['url'];
}

and use {echo:linka}

Thanks, that was the only option I found. I thought there was an easier way, but that’s fine :slight_smile:

Easily you can edit your PDF file from https://pdfinsider.com/en without any email