Home Forums ACF PRO Enter values through the database Reply To: Enter values through the database

  • You would need to insert all these default values.

    If there is a default value that will be used for each then there are some ways to deal with that.

    1) In your template where you get the value, check the value. This is a good practice anyway.

    $value = get_field('the_new_field');
    if (!$value) {
      $value = 'default value';
    // do something with value

    2) Add a load value filter

    add_filter('acf/load_value', 'default_value_for_my_new_field', 10, 3);
    function default_value_for_my_new_field($value, $post_id, $field) {
      if (!$value) {
        $value = 'my_default_value';
      return $value;

    In either case, the value can be adjusted to be different based on the post that it is used for with a bit of coding.

    If you want to insert the values into the database then you must insert 2 values for every post. 1) the field value 2) The acf field key reference. The best thing for you to do is to update at least one post with a value and then look in the database and use this as an example to see what you need to insert for each of the other posts.