Defining Fields
This guide explains how to define fields in QuickBuildWP when creating field groups. It covers standard post fields, field options, and validation rules.
1. Standard Post Fields
When creating posts, these standard fields have fixed rules, labels, and settings that cannot be modified. Use them as needed in your custom post type:| Field Name | Description |
|---|---|
post_title |
Post Title |
post_slug |
Post Slug (URL) |
post_editor |
Content Editor |
post_excerpt |
Post Excerpt |
post_trackbacks |
Trackbacks |
post_custom_fields |
Custom Fields |
post_comments |
Comments Section |
post_revisions |
Post Revisions |
post_thumbnail |
Featured Image |
post_author |
Post Author |
post_title.
2. Defining Fields
When defining fields, ensure each field has a unique name and relevant settings.Field Options Available:
A. Type
- Select the type of input for your custom field.
- Example: Use
TEXTfor a standard text input.
B. Meta Box
- Choose the meta box where this field will be displayed.
C. Label
- The label is displayed for the field in the admin panel.
D. Name
- The database field name. Each field is stored with a prefix
_qb_. This prefix is hardcoded in the plugin. - Example: If the field name is
contact_person, it is stored as_qb_contact_person.
E. Priority
- Set the field's display order.
- Lower priority fields are displayed at the top.
3. Field Validation Rules
Enable the following validation rules to ensure secure and proper data entry:Available Rules:
| Rule | Description |
| Trim | Restores the field value on validation error |
| Required | Marks the field as mandatory |
| Is Array | Allows multiple values using an array |
| Sanitize | Filters harmful input to prevent XSS |
is_numeric– Validates numeric values.is_decimal– Checks for decimal numbers.alpha– Accepts only letters.alpha_extra– Letters with extra symbols.alpha_numeric– Letters and numbers.alpha_dash– Letters, numbers, dashes, and underscores.valid_email– Checks for valid email addresses.valid_url– Validates URLs.phone_check– Ensures a valid phone number.valid_ip– Checks for valid IP addresses.valid_date– Validates date format.valid_date_future– Ensures future date entry.valid_time– Validates time format.valid_datetime– Ensures date and time correctness.valid_datetime_future– Ensures future date and time.sanitize_text– Cleans text input.
4. Custom Field Options
Each field type supports specific settings, which can be configured using JSON format in the Options field.Example:
To set a limit of 1 for an image_uploader field, use:{"limit": 1}
- Custom flag for skipping form and DB logic e.g. featured: {"create": {"public": {"skip": 1}}}
- Modifying rules for the edit form for a specific role: {"edit": {"job__candidate": {"rules": "trim"}}}
- Restrict Entity IDs field to the current post only e.g. applications: {"field_only": 1, "current_post_only": 1}
- Set a default value for a field e.g. Post Title: {"default":"Application by {candidate__post_title##post_author} for {job__post_title##entity_ids}"}
-
candidateandjobare the field group names. -
post_titleis the field name from the respective field group. -
##post_authoris used to fetch the ID of the currently logged-in user, which is then used to retrieve the related candidate post. -
##entity_idsfetches the related post ID (e.g., job post) from theentity_idsrelationship.
This setup dynamically generates a post title such as: "Application by John Doe for Graphic Designer"
-
Developer Options
- {"edit":{"form_title": "Edit Profile", "form_subtitle": "Manage your profile and account settings.", "success_message": "Your profile has been updated successfully!"}}
- {"role_limit": {"job__candidate": 1}}
job__candidate role to only one registration for this form.A user can add or edit their profile, but cannot create multiple entries (rows) for this role.
- {"submission_limit": {"job__candidate": {"unique_field": "entity_ids","error_message": "You have already submitted an application for this job. Please wait for the employer's approval."}}}
-
-
"submission_limit": Main key that defines restriction rules. -
"job__candidate": Role-specific rule. -
"unique_field": "entity_ids": Restricts submissions based onentity_ids—in your case, one application per job. -
"error_message": Custom error message shown when the limit is hit.
-