Form Fields API

wpbdp_get_form_fields( $args )

This function can be used to obtain form fields from the database based on several criteria. The returned objects are instances of WPBDP_FormField.


  • $args: (optional) Array or querystring of arguments used to query fields from the database. The valid options here are:
    • association: Field association. Valid choices are “title”, “category”, “tags” and “meta”.
    • validators: Field validators. Prepending “-“ to the validator name excludes fields with that validator.
    • display_flags: Field display flags. Prepending “-“ to the display flag excludes fields with that display flag set.
    • unique: If TRUE only the first field will be returned.


An array of WPBDP_FormField instances or just one object if the argument unique is set to TRUE.
Fields are ordered by their position (weight) inside the table. See WPBDP_FormField for more details.


Retrieve all fields (regardless of their nature) and print their label:

	$fields = wpbdp_get_form_fields();
	foreach ( $fields as $field ) {
		print $field->get_label();

Retrieve the one field with “title” association:

	$title_field = wpbdp_get_form_fields('association=title&unique=1');

Retrieve all required fields that don’t appear in the search form:

	$args = array( 'validators' => 'required', 'display_flags' => '-search' );
	$fields = wpbdp_get_form_fields( $args );

wpbdp_get_form_field( $id )

This function obtains a field by its ID. For more complex field-related queries, use wpbdp_get_form_fields.


  • $id: the field ID


A WPBDP_FormField instance if the field is found or NULL if not.

Class Reference: WPBDP_FormField


Most of the WPBDP_FormField properties are private and should not be accessed directly. Use the getters & setters for this.

Related Articles