• Resolved mkovcu

    (@mkovcu)


    Hello,

    Thanks for great plugin. It wasn’t working with ACF pro Version 5.7.11 so I investigated a little and changed this function:

    public function post_field_groups($post_id) {
    			$found = false;
    			$cache = wp_cache_get('post_field_groups-'.$post_id, 'acfpost2post', false, $found);
    			if ($found) {
    				return $cache;
    			}
                $post_type = get_post_type($post_id);
                $args = array('post_type' => $post_type);
                $field_groups = acf_get_field_groups($args);
                $count = count($field_groups);
                for ($i=0; $i<$count; $i++) {
                    $field_groups[$i]['fields'] = acf_get_fields($field_groups[$i]);
                }
                wp_cache_set('post_field_groups-'.$post_id, $field_groups, 'acfpost2post');
    			return $field_groups;
    		} // end public function post_field_groups

    Function acf_get_field_groups() was returning empty array when called with array(‘post_id’, $post_id) as argument, and acf_get_fields() also returned nothing with key as argument.

    This way it seems to work.

    • This topic was modified 5 years, 11 months ago by mkovcu.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Huebner

    (@hube2)

    Update ACF to the latest version. There were some bugs in 5.7.11.

    The reason that I use get field with those arguments is that you only want to get the field for the post where the relationship needs to be updated. Without it, say that you have the same field name on more than 2 post types, you have no idea what post will be updated, it would be whatever field is located first.

    Thread Starter mkovcu

    (@mkovcu)

    Thanks for the explanation.

    I updated ACF and now it works great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not working with ACF 5.7.11’ is closed to new replies.