You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorials/first-custom-field.md
+65-16Lines changed: 65 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,11 @@ You can learn more about WordPress basics here:
24
24
25
25
## 2. Basic Configuration
26
26
27
-
####Field Group Title
27
+
### Field Group Title
28
28
29
29
Give your field group a descriptive name, like `Movie Details` or `Product Specs`.
30
30
31
-
####Location Rules
31
+
### Location Rules
32
32
33
33
Choose where this group should appear. For example:
34
34
@@ -37,20 +37,75 @@ Choose where this group should appear. For example:
37
37
38
38
This ensures your fields appear only where you need them.
39
39
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
41
43
42
44
Make sure the field group is set to **Active** so it appears in the editor.
43
45
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
+
44
48
## 3. Adding Fields
45
49
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**
47
80
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
+
---
54
109
55
110
Repeat this process for as many fields as needed.
56
111
@@ -61,12 +116,6 @@ Repeat this process for as many fields as needed.
61
116
- Fill in test data and save the post.
62
117
- Confirm the fields save and appear as expected.
63
118
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
-
70
119
## For Developers
71
120
72
121
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