NO BUG: Can't render dynamic shortcodes

I’ve got a custom field with ACF that I use to insert a [shortcode] into a product page.
I type in the shortcode in plain text ie: [my-shortcode] without any formatting.

I would then like to call this shortcode into the product template.

If I add a ‘Shortcode’ field onto my template and add the shortcode manually ie. [my-shortcode], then it works fine and the shortcode renders the output as expected.

But if I use the dynamic tags to call the shortcode onto the template dynamically from my ACF field, it will not render and no output is displayed.
Basically the ‘Shortcode’ field only seems to accept input that is a typed in as a shortcode format ie. [my-shortcode].
It doesn’t seem to accept fetching the shortcode dynamically from ACF text field. ie. {acf-text-field-my-shortcode}

I’ve also tried to add a Simple Text field and add the shortcode both manually, as well as call it dynamically, neither works, again no output.

I’ve also tried the Rich Text field and then use the plain ‘text’ mode and adding the shortcode both manually as [my-shortcode] as well as dynamically. Again neither of these would work.

Could this be a bug?

Thanks for looking into it.

Hi Jan,
Thanks so much for your report!

To track down the possible problem, I need to know exactly what the shortcode does, where it comes from, etc. Can you give me more information on this?

Best regards,
timmse

Hey @timmse , thanks for getting back.

My bad, false alarm, I figured it out.

The ACF text field I’m using for the shortcode is inside an ACF repeater field, and the shortcode fetches a variable product price from a product ID.
So basically in my layout even if the shortcode was fetched correctly from the ACF field using the dynamic field, it didn’t execute to return the value, until I created a query loop.
As it simply didin’t know which one of the repeater variations should it display, so it was coming up ‘blank’.

Not sure if I made the explanation more confusing, but now since I made a query loop from the repeater field, it now displays correctly.

Many thanks for your time.

1 Like