Support

Account

Home Forums ACF PRO Image and Repeater Fields not returning correct values

Solving

Image and Repeater Fields not returning correct values

  • I built a custom nav walker that gets ACF fields from a custom post type. There is an image field (returns image object), repeater field (sub fields are text fields), and a WYSIWYG field.

    The client is using a CRM plugin named PressPoint.

    The fields return as normal on regular theme pages – so everything is working fine. On pages where the plugin uses it’s own templates, the Image and Repeater fields are broken – there is no image object or repeater sub-fields returned. The WYSIWYG field still works, and I can get an image ID to return.

    Does anyone have any experience with an issue like this?

    I am running ACF Pro 5.5.10 on WP 4.7.3. ACF Pro is installed as a must-use plugin, PressPoint is not.

  • On pages where the plugin uses it’s own templates…

    You’ll need to edit these templates, or hopefully, the plugin provides hooks that will let you modify what is being shown. It sounds to me like the other plugin is displaying the values contained in the custom fields. Image fields store attachment IDs and the actual repeater field only stores the count of rows for the repeater. It is impossible to display these types of fields without using the ACF functions or some other method of converting the values into something that can be displayed.

    My first step would be to look at that plugin. I’d probably just start digging through their code to see if I could find any usable hooks. Maybe see if they have documentation. Probably end up trying to contact the authors of that plugin to see what they provide for modifying their templates if I found nothing else.

  • Hi @john, I appreciate the response.

    I’m not quite sure what you mean…the ACF get_field functions are coming from code that I wrote in a walker that gets called in wp_nav_menu() in header.php and an image object in footer.php. If I was to edit the plugin templates, what would I be looking to edit?

    Additionally, I was in contact with the plugin author, who said the issue may be from “the attempt to bootstrap a post object”…which I am a little lost on as well, but thought might be helpful here.

    If it seems best/fastest route, I may just update how the ACF field values are pulled in with custom functions (switch image object to ID, etc.)

  • Sorry, I missed that. I was assuming you meant something different.

    In almost all cases where image field, repeaters, or anything in ACF that does not store a “text” value are not returning what they are supposed to it is due to some filter, usually a pre_get_posts filter, that is interfering.

    There could be some other filters doing this, but like I said, 99% of the time images returning IDs instead of images or repeaters returning numbers instead of rows, it has been a pre_get_posts filter.

    Probably not much help since anything that filters WP_Query can cause this.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.