Support

Account

Home Forums Add-ons Repeater Field Deleting field data manually from DB

Helping

Deleting field data manually from DB

  • Hello, I’m using ACF 3.5.8.2 and am wondering what to look for in a database if I want to delete fields manually? I’ve got a situation where I deleted some repeater fields on a page but the data is still being pulled into the site because it’s still in the DB but I’m unclear how to go about deleting fields manually. Do I just look up the post ID # in _postmeta table and check all corresponding rows and delete?

  • Old question, but for anyone that’s looking to delete data from the database

    Standard field names including top level repeaters and other fields with sub fields, there are two fields that need to be deleted

    
    $field_name
    '_'.$field_name
    

    for repeater and other sub fields

    
    $repeater.'_'.$row.'_'.$sub_field
    '_'.$repeater.'_'.$row.'_'.$sub_field
    

    for nested repeaters

    
    $repeater.'_'.$row.'_'.$nested_repeater.'_'.$row.'_'.$sub_field
    '_'.$repeater.'_'.$row.'_'.$nested_repeater.'_'.$row.'_'.$sub_field
    

    the above continues with each nesting level
    the following like value will remove all of the fields and sub fields, be careful with collisions with other fields, back up your DB first.

    
    DELETE FROM wp_postmeta WHERE meta_key LIKE '%'.$field\_name.'%';
    

    You should escape underscores as it is a character in SQL that stands for any one character. field_name and fieldXname will both be removed if you do not escape the _

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

The topic ‘Deleting field data manually from DB’ is closed to new replies.