Support

Account

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.