I don’t know where you got this filter-name from, but this doesn’t exist.
To create a dynamic-data-tag, you need to first register it:
add_filter('bricks/dynamic_tags_list', function ($tags) {
$tags[] = [
'name' => '{custom_prdouct_pdf}',
'label' => 'Custom Product PDF',
'group' => 'My Dynamic Data Group', // Change to your Liking
];
return $tags;
});
After that we have to write some logic. In your case we need to use these two filters:
add_filter('bricks/dynamic_data/render_content', 'prexix_render_custom_product_pdf', 20, 3);
add_filter('bricks/frontend/render_data', 'prexix_render_custom_product_pdf', 20, 2);
function prexix_render_custom_product_pdf($content, $post, $context = 'text')
{
if (strpos($content, '{custom_product_pdf}') === false) return $content;
$value = '';
if (isset($_GET['download - pdf'])) {
$product_id = intval($_GET['download - pdf']);
$pdf_url = get_field('product_pdf', $product_id);
if ($pdf_url && filter_var($pdf_url, FILTER_VALIDATE_URL)) {
$value = $pdf_url;
}
}
$content = str_replace('{custom_product_pdf}', $value, $content);
return $content;
}
This code was not tested, but should work from what I imagine.
And remember to use dynamic data with only one bracket on each side {custom_product_pdf}.
Cheers Suat