Add fields to posts, users and terms
Attach a Morphic model to WordPress posts, pages, users or taxonomy terms. Its fields then appear in the WordPress edit screens, next to the content.
Before you start
- You need the administrator role to change the model.
- You need a model with the fields you want to show in WordPress.
Steps
- Open the model.
- Select Advanced.
- In the WordPress card, turn on Add these fields to WordPress content.
- In Show on, select where the fields appear. The list has Posts, Pages and Users, plus your other post types and taxonomy terms.
- Select Save changes.
- In WordPress, open a post, a user profile or a term edit form. The fields appear in a box on a post, a section on a user profile, or a row on a term form.
- Enter values in the model's fields.
- Save the post, user or term. The values are stored as a Morphic entry for that object.
Field options for attached fields
- Required: the save fails when the field is empty and has no default.
- Default value: used only when the field is missing from the saved data.
- WordPress id: each attached model gets a hidden WordPress id field, with a unique rule. It links the entry to the WordPress object.
- Secret: fields with a secret setting are not saved from the WordPress box.
Result
The WordPress object has saved attached fields. Reopen the post, user or term to see the values.
If a save fails in wp-admin, a notice shows the reason, for example Morphic fields were not saved: code: required.