Home Forums ACF PRO A lot of weird things happening Reply To: A lot of weird things happening

  • My get_acf_key() function looks like:

    function get_acf_key($field_name) {
    global $wpdb;

    return $wpdb->get_var(”
    SELECT meta_key
    FROM $wpdb->postmeta
    WHERE meta_key LIKE ‘field_%’ AND meta_value LIKE ‘%$field_name%’ ORDER BY meta_key DESC;

    I am aware this can cause problems if two fields have the same name however I am making sure that they aren’t on my end. And this helps with possible inconsistencies in keys between different environments which lets me just use the same naming. The problem is in the database there are now duplicates of the fields after running the import script from the other post. The duplicates don’t show in the backend however, only in the database. So the script appeared to import the fields into the new structure but left the old meta data still there. I am not sure what to do about this. It would be good if there was a manual update available that would update to the new version and clean the old data out.