Get featured image filename (not URL) via Dynamic Data. Is there a native way?

Hi,

I am working with Bricks Dynamic Data and trying to get only the filename of the featured image, not the full URL.

Example:

From

https://example.com/wp-content/uploads/2025/01/hero-image-1200x800.jpg

I only need:

hero-image-1200x800.jpg

So far I found that:

  • {featured_image:url} always return the full URL
  • Bricks Dynamic Data does not seem to offer any string manipulation like basename, regex or filters
  • Media related dynamic data exposes URL, ID, alt text, etc. but not the filename itself

I am aware that this can be solved with custom PHP using {echo:my_function} or by registering a custom dynamic field, but my question is:

Is there any native or simpler Bricks way to get the featured image filename without custom PHP?

Maybe something via attachment object, media fields or a lesser known dynamic tag?

Thanks in advance.

PHP or a Bricks filter implemented via PHP, you only need to get the text after the last /.

Thanks for the input. After digging deeper into the Bricks dynamic data documentation and testing multiple approaches, I could not find a truly native way to get the featured image filename via Dynamic Data.

In the end, the only reliable solution I managed to get working was a shortcode that reads the attachment file directly from WordPress:

add_shortcode('featured_image_filename', function () {
    $post_id = get_queried_object_id();
    if (!$post_id) {
        return '';
    }

    $thumb_id = get_post_thumbnail_id($post_id);
    if (!$thumb_id) {
        return '';
    }

    $file = get_attached_file($thumb_id);
    if (!$file) {
        return '';
    }

    return basename($file);
});

This works fine in Bricks, but honestly I do not consider it an especially elegant or Bricks-native solution, more of a workaround.

So if anyone knows a cleaner or more native approach using Bricks Dynamic Data or an officially supported API, I would be very happy to hear about it.