ACF file URL postmeta field not working

I'm trying to create a button and use the postmeta field to populate the url of the file I want it to link to, but it is not working. It is returning the value 0.0.0.173 instead of the URL when clicking the button.

In ACF I have created the field type file and set the return value as URL. The file I'm uploading is a PDF and I have it set to allow all file types.

Comments

  • Hi,

    Please send us the WordPress dashboard and FTP access privately thru the contact form, which is on the right side at [Links visible only for registered users] and we will check what might be the reason.

    Notice!

    Please attach a link to this forum discussion.

    Sending incorrect or incomplete data will result in a longer response time.

    Therefore, please ensure that the data you send are complete and correct.

    Thanks

  • I've emailed through the envato messaging system. Awaiting your reply.

  • Thanks! We just found where the problem was.

    So, postmeta:{id} works for simple values ​​(like text or number, for example) and in most cases it will also work with acf, but when the returned value is modified by acf, you need to use acf:{id} instead which passes the value through the acf function.

    Therefore, in this case, you should use {acf:floor_plan_pdf} instead od {postmeta:floor_plan_pdf}

  • Thank you! That works now!

  • You're welcome :) Happy to help!

  • On a related note. It would be beneficial if we could sort the query loop by any of the acf fields. In this instance, if I could create loops that sort the floor plans by square footage from least to most, or number of bedrooms, etc it would be nice. That would give you many more options for displaying the posts.

  • Thanks for suggestion, we will consider it in future updates for sure.

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.