Hi! I’m using advanced custom fields pro and i have found an issue.
I’m getting post-attachment-id instead file url (acf file).
On my localhost, i’m using get_field(‘myfilefieldname’, $post->ID’) to retrieve an url from an uploaded video, it works. (ACF set to return url of a file)
When i upload to my test server, the same function give me the post-attachment-id.
Using multisite, path based http://mysite.com/mynetworksite on localhost and webserver
Using normal (on wp-admin/database) acfs in localhost, testing $_server[http_host] and using exporting (php) for webserver
Same (something like > if webserver loads config-acf.php)
Php versions: 5.6 on localhost and webserver
Mysql versions: 5.0 on localhost, 5.5 on webserver
I’m getting other values trough this way.
I’ve tried to change the return value to array, and when i’ve did it, i’ve got an error on invalid index for the file object.
Please, help me.
Greetings from Brazil.
I’m creating the field groups via wp-admin, on acf front-end.
After, i’m exporting via exporting tool (from acf) and including on my functions.php.
I’m using a network for many sites (government), so i need my custom fields defined on my theme, i can’t use json import/export process every time i need an update, for each site.
The site where i’ve created my cfs is id 3, same on localhost and webserver.
I can retrieve a lot of data correctly, but in some cases, i’ve got post-attachment-id instead of my return option.
I’m in contact with the acf team to find the solution.
The topic ‘File field: Getting url on localhost but getting post-attachment-id on server’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.