Home › Forums › Bug Reports › get_fields() not working with fields named as number › Reply To: get_fields() not working with fields named as number
The short answer: Field names cannot be numbers.
The long answer:
I suspect that your call to get_fields()
when you have fields with numbers as names is causing a php error.
ACF uses the equivalent of get_post_meta($post_id)
a core WP function to get all the meta values. This returns an array of meta_key => meta_value
pairs. It then loops through these results using
foreach( $meta as $k => $v ) {
This is a standard way to loop through an array where you need the index and value. This creates sets $k to 1
, which is then translated into the varialble $1
. In PHP, variables that start with a number are syntax errors.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.