Support

Account

Home Forums General Issues Values stored in wp_postmeta OR wp_acf_values

Helping

Values stored in wp_postmeta OR wp_acf_values

  • Hi,

    I recently took over a project from a colleague who has left our company (so I cannot ask him for his insight) and discovered something weird:

    For every post created after some day in mid-April it’s acf values are stored in a table called wp_acf_values, newer posts store them in wp_postmeta.

    So my problem is this: my theme reads the values with get_field(‘xxx’) which apparently only reads wp_postmeta. So for new posts I can use custom fields in my theme, but my older posts are somewhat broken.
    Is there maybe a function that reads wp_acf_values, so I can do a quick fix like this?

    $value = get_field('xxx');
    if ($value == '') {
    $value = read_from_wp_acf_values('xxx');
    }

    Thanks in advance,
    I hope that was somehow understandable
    Maiwerk

  • Hi @Maiwerk

    I believe the wp_acf_values table was used in version 1 or 2, not 100& sure as it has been so long since then.

    Version 3 and 4 definitely use the standard postmeta table, so this is why your older posts and newer posts use different tables.

    I would imagine that the version 3 plugin would have included an update script to migrate across all the data.

    Can I ask you what version of ACF did it originally use, and what version does it use now?

    To find a function such as read_from_wp_acf_values, you will need to download an older version of ACF which contains the logic to use this table and then do a copy / paste into your functions.php file.

    That said, It would be smarter to just migrate across the data. I would recommend that you dig through the source code of v3 and find the update.php file which contains the migration code.

    Good luck

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Values stored in wp_postmeta OR wp_acf_values’ is closed to new replies.