Skip to content

Commit 2cb0781

Browse files
authored
Update first-custom-field.md
1 parent 21f7572 commit 2cb0781

File tree

1 file changed

+65
-16
lines changed

1 file changed

+65
-16
lines changed

docs/tutorials/first-custom-field.md

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ You can learn more about WordPress basics here:
2424

2525
## 2. Basic Configuration
2626

27-
#### Field Group Title
27+
### Field Group Title
2828

2929
Give your field group a descriptive name, like `Movie Details` or `Product Specs`.
3030

31-
#### Location Rules
31+
### Location Rules
3232

3333
Choose where this group should appear. For example:
3434

@@ -37,20 +37,75 @@ Choose where this group should appear. For example:
3737

3838
This ensures your fields appear only where you need them.
3939

40-
#### Active
40+
**Note:** This fine-grained control allows you to define SCF fields once and reuse them across different post types, templates, or components.
41+
42+
### Active
4143

4244
Make sure the field group is set to **Active** so it appears in the editor.
4345

46+
**Note:** Some features require the field group to be **enabled** and **exposed via the REST API**. To future-proof your configuration, we recommend setting **Show in REST** to `true` when creating your field groups.
47+
4448
## 3. Adding Fields
4549

46-
Click **"Add Field"** to create your first field. For each field, configure:
50+
Click **"Add Field"** to create your first field, configure:
51+
52+
### Minimum required settings
53+
54+
To create a functional custom field, you only need to define the following in the **General** tab:
55+
56+
- **Field Type** (e.g., Text, Image, Select): Defines the kind of input
57+
- **Field Label**: The name shown in the editor
58+
- **Field Name**: A unique, code-friendly identifier (no spaces; dashes and underscores allowed)
59+
60+
For example, you could create fields like:
61+
62+
- **"Movie Title"** (`movie_title`) — a text field to store the name of the movie
63+
- **"Director"** (`director`) — another text field to store the director's name
64+
- **"Release Year"** (`release_year`) — a number field to store the release year
65+
66+
> **Note:** All other settings are optional and provide extra control or visual customization.
67+
68+
---
69+
70+
### 🔧 Full settings overview by tab
71+
72+
### General
73+
74+
Basic field definition and default behavior:
75+
76+
- **Field Type**
77+
- **Field Label**
78+
- **Field Name**
79+
- **Default Value**
4780

48-
- **Label**: The visible name of the field (e.g., `Director`)
49-
- **Field Name**: A unique identifier used in code (e.g., `director`)
50-
- **Field Type**: Choose from text, textarea, number, image, checkbox, select, and more
51-
- **Instructions**: Optional helper text to guide users
52-
- **Required**: Whether this field must be filled in
53-
- **Default Value** and **Placeholder**: Optional presets
81+
### Validation
82+
83+
Rules to control what values are allowed:
84+
85+
- **Required**
86+
- **Minimum / Maximum Values**
87+
- **Allowed Characters / Pattern**
88+
- **Custom Validation Message**
89+
90+
### Presentation
91+
92+
Controls how the field appears in the editor:
93+
94+
- **Placeholder Text**
95+
- **Instructions**
96+
- **Wrapper Attributes**
97+
- **Hide Label**
98+
99+
### Conditional Logic
100+
101+
Display logic to control field visibility:
102+
103+
- **Enable Conditions**
104+
- **Condition Rules**
105+
106+
> **Note:** Not all options appear for every field type. Each field may expose different settings depending on its nature.
107+
108+
---
54109

55110
Repeat this process for as many fields as needed.
56111

@@ -61,12 +116,6 @@ Repeat this process for as many fields as needed.
61116
- Fill in test data and save the post.
62117
- Confirm the fields save and appear as expected.
63118

64-
## Next Steps
65-
66-
- Display the custom field values on the frontend using SCF template functions
67-
- Use conditional logic or field groups to organize complex forms
68-
- Combine with taxonomies or other field groups for richer structures
69-
70119
## For Developers
71120

72121
While Secure Custom Fields makes it easier to manage and display custom fields with a user-friendly interface, WordPress also includes native support for custom fields that can be managed programmatically using functions like `get_post_meta()` and `add_post_meta()`.

0 commit comments

Comments
 (0)