ACF File upload returns ID no matter what

I have an ACF file upload field that i use to dynamically populate a button.

It works when i populate the button so that’s cool, however if i wanted to show it as text, I’d get a number, an ID.

What i want to do is the following: i want to check if the URL contains the format “.pdf” and return a button, if instead the button returns an external link, for example, then i’d return another button.

This is a problem because since the button returns an ID, the conditions " [meta] NOT IN .pdf" is the one that always returns TRUE.

Is there a way to achieve this?

Let’s imagine i’d like to show a different button only if the file was NOT a PDF. how would i go about it? it seems using “not in” or “in” with a value lke “.pdf” is not working, because it always returns an ID instead of the actual URL (and the ACF setting is set to return the URL, even though, it always returns the same ID no matter the configuration that i set in ACF)

Hey Franctic,

Thanks for reaching out!

Would you mind sharing with us your website URL where you implement the functionality? In that way, we can help you with your concerns.

Thank you.

Hi there, i added all the info on my first reply. there’s only one layout for “WooCommerce Single”. that’s the one (it has the same name).

Hey Franctic,

Upon checking your setup instead of using raw post meta, you should use {{dc:acf:post_field field="download_file" }}. ACF does some formatting to a URL behind the scenes.

Thank you.

Hm, i think i had used the post_field from ACF but ok. i’ll give that a try.

Hello Franctic,

Please let us know how it goes.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.