Home Forums Bug Reports Fixed settings Reply To: Fixed settings

  • Hi @greeneinstitute

    For your first issue, I’m not following exactly what you mean. Do you mean you changed the location rule to another term?

    As for changing the fieldname. When you change the fieldname you’re effectively telling ACF and WordPress that the values are going to be saved to a new meta key. The field name is the meta key. So when you changed it the old values are no longer connected to the field. They still exist in the DB tho so if you change it back the values are there.

    My best tip is to always think about the field name the first time around so you’ll avoid issues like this. If you feel like there’s too much job entering the values again you can either run a DB Query to change all meta_keys of “title” to “job_title” OR do some backwards compatibility code when you fetch the info in your theme:

    //This will fetch the new job_title if it exists, otherwise it'll try to get the old meta value of "title". If that doesn't exist either $job_title will just be an empty string (NOT a false).
    $job_title = ( get_field('job_title') ? get_field('job_title') : get_post_meta($post_id, 'title', true) );