Home Forums Front-end Issues Values from Post_Object fields not showing in acf_form()


Values from Post_Object fields not showing in acf_form()

  • Hello,
    I’m using acf_form() to create a frontend form, and a couple of my custom fields are post_objects (to other custom post types). The form renders fine on the front end, saves & loads data – however the post_object fields do not populate with any post titles. It’s as if no posts exist within those custom post types. One of these fields is set to allow multiple values, and one is not. When inspecting the DOM, no values are present inside the <div> or <select>, respectively.

    The only time my acf_form shows any values for these fields is then a post object has already been set in wp_admin, and then the only option listed in my frontend form is the value already selected (no other posts of that post type).

    I’ve tried it many different ways, ultimately simplifying my acf_form() to the exact code in the ACF example documentation for acf_form(), substituting only the post type slug.

  • Some more info… I decided to just try and loop through each field manually and bypass acf_form(), so I tried using both get_field_objects() and get_fields(), and to my surprise, all of my custom fields were shown when I printed the returned array EXCEPT for my two relational (post object) fields. I’m logged in to my wordpress site, and I’ve tried this both with plugin versions 5.5.3 and 5.2.8 with the same results.

  • When you are logged in and testing this, are you logged in as an admin or some other user type? If it’s as some other user type then this could be a permission issue with that user type not having access to the post of the custom post type for some reason. I think there have been similar issues posted about that here. If you’re logged in as an admin and seeing this issue then I would start by deactivating other plugins because I cannot reproduce this problem on a test site with only ACF installed.

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

You must be logged in to reply to this topic.