Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Razvan Mocanu

    (@razvanmo-1)

    Hi,
    Here is an example on how to add fields programatically in Profile Builder:

    $fields = get_option('wppb_manage_fields');
    $fields[] = array( 'field' => 'Input', 'field-title' => 'Address3', 'meta-name' => 'address_meta3', 'overwrite-existing' => 'No', 'description' => '', 'id' => '102', 'required' => 'No' );
    update_option('wppb_manage_fields',$fields);
    }

    Make sure the meta-name and id are unique.
    Please note that you will need to have the Extra Fields feature, available only in Profile Builder Pro or Hobbyist.

    Thread Starter mrjhon01

    (@mrjhon01)

    Thanks! That a good Help!

    Thread Starter mrjhon01

    (@mrjhon01)

    Please Still need some help!

    what if Multiple fields?

    should I use nested array for multiple fields?

    Plugin Author Razvan Mocanu

    (@razvanmo-1)

    Hi,
    The $fields array from the manage fields option, contains for each entry another array, representing a field’s settings. So yes, it is a nested array.

    To better understand the structure of the $fields variable, you can do a var_dump on it.

    Thread Starter mrjhon01

    (@mrjhon01)

    Okay thanks! So much help! Thanks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Programmatically Add Fields’ is closed to new replies.