Frontend Post Forms

Form submissions in Greyd Forms can be mapped to WordPress posts, either creating a new post or updating an existing one. This is configured through a dedicated Post Interface available for every form, covering permissions, post type selection, field mapping, and the logic that determines whether a submission results in a new post or an update. This feature is only available with the Growth and Scale subscriptions.

The Post Interface is an additional configuration option for Greyd Forms that allows data submitted through a form to create a new post or update an existing one. It complements the general form Interface described in the Forms → Interfaces documentation and is configured separately for each form.

Interface Setup

The interface configuration for creating or updating posts is located in the Metabox settings under Interfaces for each individual form. A form must have at least one field in order for the Metabox to appear.

Screenshot of the Interfaces section in a Greyd Form editing screen. It shows a setting "Send to posts" with a Yes checkbox next to it to enable this feature.

To begin, enable the “Send to posts?” checkbox. This reveals the additional settings required to complete the setup.

Permission

The permission setting determines which users are allowed to trigger the creation or update of posts through this form and should be treated as an important security setting. Permission should only be granted to known users or a defined and trusted group of users. Granting this ability to an uncontrolled group of users allows the content of a page to be manipulated in unpredictable and potentially harmful ways. An incorrectly configured permission can open attack vectors for malicious actors and may lead to a full compromise of the website.

The Permission dropdown shows all available user roles that exist in the WordPress installation.

Screenshot of the "Send to posts?" setting activated, with the Permissions dropdown to select one of the existing user roles.

If “everybody” or “logged out users” is selected as the permission, a security warning is displayed.

The basic permission is set by user role. Additional, more granular verification can be implemented using the filter greyd_forms_posts_interface_permission, which you can find in the Greyd Forms Filter Snippets documentation.

If no permission is set, the interface remains inactive: no further settings can be configured, and form submissions will not create or update any posts.

Post type of new post

Screenshot of a selected permission and the Post type of new post dropdown, explained in the paragraphs below.

A post type must be selected to continue the setup. All public post types are available for selection, including Post, Page, and any custom post types.

Alternatively, “Synced post type” can be selected, which displays an input field for entering the desired name of a new post type. A custom post type with all form fields mapped to dynamic meta fields is created automatically. Basic settings of this post type, such as standard features and taxonomies, can be adjusted afterward in Greyd.Suite → Post Types. The title of the post type should not be changed.

Screenshot of the input field for the synced post if the Synced post type entry has been selected.

Changing the name or title of a synced post type creates a new post type. The previous post type and its associated posts continue to exist but are no longer synced with the form. Dynamic meta fields are created and updated automatically: adding a form field creates a corresponding meta field, while deleting a form field after the synced post type has been created does not remove the associated meta field, which remains persistent with the post type. As a result, additional dynamic meta fields can also be added manually by editing the synced post type.

It is recommended to complete and save the form, including adding all input fields in the editor, before setting up the interface. This ensures that all fields are synced correctly.

Enable Full Sync of Changed Form Fields

Screenshot of the Enable full sync of changed form fields option.

When a synced post type is selected, the option to fully sync changed form fields becomes available. Enabling this option prevents the dynamic meta fields of the synced post type from being adjusted manually. Any changes made are reset the next time the form is saved, and fields that were removed from the form are also removed from the post type.

Status of New Post

Screenshot of the Status of new post dropdown with Draft (default) selected.

A new or updated post can be created either as a draft or published directly. If “published” is selected, a warning is displayed, noting that this can present a security risk and recommending that inputs be validated and a review process be considered, for example by creating posts as drafts and publishing them manually.

Allow post editing

By default, a form submission always creates a new post using the configured post type. To update an existing post instead, enable the Allow post editing toggle in the interface settings.

Screenshot of the Allow post editing checkbox activated and showing the which post to edit dropdown.

When enabled, the target post is determined entirely by the server — never from the submitted form data — and two hidden fields are automatically added to the form: the post ID to update and a signed, time-limited token that ties the submission to that specific post and browser. No manual field mapping is required for this to work.

The Which post to edit setting determines which post is updated:

  • The current post (where the form is placed): updates the post the form is displayed on. This is the default.
  • A specific post: always updates the post ID entered in the Specific Post ID field, which appears once this option is selected.

Because the target post is resolved and signed by the server rather than read from the submission, it cannot be changed or forged through the form itself. For security reasons, this connection expires after a set time (one day by default). If a form is submitted after the page has been open too long, the token has expired and the submission is rejected with a message asking the user to reload the page. If the browser blocks cookies, the submission is rejected with a separate message asking the user to enable cookies.

Fields Mapping

Fields mapping determines which form fields are used to create or update a post. Each form input field can be mapped to a post property, which may be a standard post field, a taxonomy, or a dynamic meta field. Currently, only meta fields created with Greyd post types can be edited.

Screenshot of the Fields mapping section, where each form field is assigned to a specific post property or post meta field.

If a synced post type has been selected, all form fields are mapped to dynamic meta fields automatically. Individual form fields can additionally be mapped to standard post properties or taxonomies.

At least a post title should be mapped individually; otherwise, created posts will be assigned random titles.

By default, the author of a new post is the user who submitted the form. To assign a different author, a form input must be mapped to the post author property.

Additional processing of form field values can be implemented using the filter greyd_forms_posts_interface_data, which you can find in the Greyd Forms Filter Snippets documentation.

The values of the post array used to create or update the post can be filtered using greyd_forms_posts_interface_postarray, which you can find in the Greyd Forms Filter Snippets documentation.

Video

You are currently viewing a placeholder content from Vimeo. To access the actual content, click the button below. Please note that doing so will share data with third-party providers.

More Information

More in this section

FAQ