AdvancedCustomFields / AdvancedCustomFields/acf

get_field() with Group field not working anymore

Open
#554 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hi folks,

I've developed a Plugin long time ago. Now my client ask me to fix a bug. After some research I found the problem:
The get_field() function is not working anymore with a Group field.

global $post;
$attributes = get_field('attributes', $post->ID);
$price = get_field('price', $post->ID);
$attributes_price = get_field('attributes_price', $post->ID);
var_dump($attributes); 
// bool(false) 
var_dump($price);
// NULL
var_dump($attributes_price);
// string(6) "103,00"

I've also checked this behavior on another test site, but there get_field() on Group field returns an array of sub fields.

Any hint what is causing this issue?

Thank you!

Advanced Custom Fields PRO: 5.10.2
WordPress: 5.8.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing get_field() with the reported Group field on Advanced Custom Fields PRO 5.10.2 and WordPress 5.8.1, comparing the attributes, price, and attributes_price results with the test site where the Group field works. Done means identifying why the Group field returns false or null and restoring the expected array of subfields.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.