Support

Account

Home Forums General Issues Database structure

Solving

Database structure

  • Hi,

    I want to understand how does ACF store data for custom fields.

    Does it store it in the custom post types the fields are related to? If so I couldn’t find any documentation about it.

    If it stores in a custom table in MySQL then what is the table structure?

    Kind regards,
    Tony

  • ACF stores data for custom field related to posts in the post_meta table, just like standard wp custom fields. It stores custom fields for everything else in the options table.

    Every field has two database rows associated with it. The first is your standard meta_key => meta_value. The other is a reference entry, the meta_key is your field name with an _ (underscore) at the beginning and the value is the ACF field key. this tells ACF how to handle your value. The same pattern is used for options but the field names have more things added to the field names.

    Some fields are far more complicated, like repeaters and flexible content.

    All of the data stored using ACF can be retrieved using the standard WP function like get_post_meta and get_option if you use the right meta_key or option_name.

  • If I set up a location rule so that the custom field only shows on just pages, then I put information into the field on each page, what happens to the data I’ve entered into the field for these pages if I change the location rule to display on posts instead of pages? Is this data still taking space up on the database? Do I have to delete all the field information from the pages before changing the rule so I don’t end up with data I don’t want in the database?

    I hope this makes sense.

    Regards,

    Paul

  • what happens to the data I’ve entered into the field for these pages if I change the location rule to display on posts instead of pages? Is this data still taking space up on the database?

    Yes, the data that was added for posts will still be there.

    Do I have to delete all the field information from the pages before changing the rule so I don’t end up with data I don’t want in the database?

    Deleting what’s in all the fields first won’t do anything except remove the content. The empty content will still be in the database. There isn’t any way to delete the fields completely when you change the locations except to go into the database and do it manually.

    It’s a good idea to plan the development of a site so that once data is entered it does not need to be removed. I think there is a plugin that will convert the post type of a post in WP, in this case you could change your pages to posts and data in the fields will go with it.

  • Thanks John that clears things up for me.

  • It is a good idea to plan the development of a site. I change the rules of location. To display on posts instead of pages? Is there still space in this database? Do I have to delete all the field information from the pages before changing the rule so that I don’t end up with the data I don’t want in the database?

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

The topic ‘Database structure’ is closed to new replies.