The Post Management action allows you to create forms and add actions for creating and updating posts of any post type in WordPress.
For example you could create a form for adding a:
- Post
- Page
- Product
- Custom Post Type
This add-on is compatible with the following WordPress plugins:
About WordPress Post Records
Post records are the heart of WordPress. They are used for storing blog articles, revisions and comments and are also used by other plugins such as WooCommerce for storing order information.
There are two tables in the database that store information about WordPress posts. The wp_posts
table stores basic information about posts (title, date added etc), whereas the wp_postmeta
table is used to store additional information about them, for example, custom fields that you create yourself.
The ability to manage custom posts fields is not native to WordPress so you will need to use a plugin to configure them. We recommend using the Advanced Custom Fields (ACF) or Meta Box plugin.
The WS Form Post Management add-on allows you to create and edit post meta data by mapping your form fields to meta keys.
Updating Posts
As well as creating posts, the post management add-on can also be used to update posts. This done by populating the form with existing post data and then using the post management add-on to update the post data. You can learn more about that here:
Creating A Post Management Form
Automatically (Recommended)
WS Form can create a form for any of the post management functions in a single click. This process not only creates a form but also fully configures WS Form so that the form is ready to use immediately.
To create a post management form in WS Form:
- Click WS Form in the WordPress administration menu.
- Click Add New.
- Select the Post Management tab at the top of the page.
- Click on the post type you would like to create a form for.
- Wait a few moments while the form is created.
That’s it! Your form will be created and is ready to add to your website.
Tip: We recommend using the automatic method. Not only does this method create the form for you, but it also maps the fields and creates checkboxes for taxonomies associated with the post type you selected.
Manually
It is also possible to use any form created in WS Form and add an action so that it is creates a post when a user saves or submits their form.
To add a post management action:
- When editing your form, click the Actions icon at the top of the page. The Actions sidebar will open.
- Click the Add icon to add a new action.
- Select Post Management from the Action pulldown. A series of settings will appear.
As with all sidebars in WS Form, click to the Save button at the bottom to save your changes, or click Cancel to disregard your changes.
The post management action settings are as follows:
When Should This Action Run?
You can choose to add the WordPress post when the form is saved, submitted, or both.
Post Type
Choose the type of WordPress post you would like to create.
Post ID
If this setting is blank, a new post will be created.
Tip: When this add-on creates a new post, you can use the #post_id
variable in other actions to retrieve the new post ID.
If this setting is not blank, the value entered should be the post ID that you wish to update.
You can enter WS Form variables in this field. Variables in this setting are parsed once the form has been submitted.
Here are some examples of values you can enter into this field:
Post ID | Description |
---|---|
123 |
Update the post or page with the ID: 123. This method is a good way of testing post updates. |
#post_id |
Update the post or page that the form is shown on. The #post_id variable returns the ID of the current post or page. |
#field(456) |
Use the submitted value of field ID: 456 as the post ID to update. For example, if field ID 456 is a hidden field with the number 123 in it, post ID 123 would be updated. |
Passing the Post ID as a Query Variable
It is possible to specify the post ID you wish to update as a variable in a query string. For example:
https://mysite.com/my-form-page/?post_id=12345
This example would push the submitted form to post ID 12345.
To do this:
- Add a hidden field to your form.
- Set the Default Value setting to
#query_var("post_id")
. - In the Post Management action, enter
#field(123)
in the Post ID setting. Change 123 to the ID of the hidden field you added.
You can combine this with Auto Populate under Form Settings to create a post editing feature.
Status
Select the status you would like the newly created post to have.
Status | Description |
---|---|
Default | New = Draft, Existing = Inherit |
Publish | Post is viewable by everyone. |
Scheduled | Scheduled to be published in a future date. |
Draft | Incomplete post viewable by anyone with proper user role. |
Pending | Awaiting a user with the appropriate capability to publish. |
Private | Viewable only to WordPress users at Administrator level. |
Author
Select the author of the WordPress post. This defaults to the current user signed into the website.
Restrict Updates to Author
By checking this setting, updates to posts will be restricted so that only the original author can update their own post. That user will need to be signed in to update their post.
Field Mapping
Field mapping tells WS Form which of your form fields relate to the corresponding post being created.
To map a field:
- Click the Add icon at the bottom right of the field mapping section.
- In the left-hand column, select your form field.
- In the right-hand column, select the corresponding post field.
- Repeat this process for each field on your form.
- Click the Save button at the bottom of the sidebar to save your changes.
Field Meta Mapping
The add-on also supports mapping fields to post meta data.
To map a field to meta data:
- Click the Add icon at the bottom right of the meta mapping section.
- Select your form field.
- Select the meta key you would like to create using the form field.
- Repeat this process for each field on your form.
- Click the Save button at the bottom of the sidebar to save your changes.
Custom Meta Mapping
The add-on also supports setting custom meta keys to values.
To add a meta key-value pair:
- Click the Add icon at the bottom right of the meta mapping section.
- Enter the meta key you would like to set a value for.
- Enter the meta value you would like to set the meta key to.
- Repeat this process for each meta key-value pair.
- Click the Save button at the bottom of the sidebar to save your changes.
Deduplication by Field
You can avoid deduplication by specifying which of your form fields you want to be unique for the WordPress post type being created.
To specify a field that you do not want duplicates for:
- Click the Add icon at the bottom right of the deduplication by field section.
- Select your form field.
- Repeat this process for each field on your form that you do not want duplicates for.
- Click the Save button at the bottom of the sidebar to save your changes.
Attachment Mapping
File and signature fields can be mapped so that they are uploaded as attachments to the post when it is added.
To add a file or signature field as an attachment:
- Click the Add icon at the bottom right of the attachment mapping section.
- Select your form field.
- Repeat this process for each field on your form that you want to include as an attachment.
- Click the Save button at the bottom of the sidebar to save your changes.
File fields that are marked as multiple will result in multiple attachments if more than one file is uploaded.
Featured Image
Select a file or signature field you would like to use for uploading a featured image. The file will be uploaded to the media library and also assigned as the post’s featured image.
Term Mapping
You can also assign terms to the post that is created. These include:
- Post categories
- Post tags
- Custom taxonomies
We recommend using a choice field for term mapping, such as checkboxes.
For hierarchical terms you should make sure the submitted value is the ID of the term. You can do this by ensuring your checkbox data grid has two columns, one called Values, which would contain the term IDs, and another column called Labels, which would contain the term names.
For non-hierarchical terms, such as tags, you should make sure the submitted value is just the name of terms.
To specify which fields are used to assign terms to a post:
- Click the Add icon at the bottom right of the term mapping section.
- Select the taxonomy the form field relates to.
- Select your form field.
- Repeat this process for each field on your form that you want to map as containing terms.
- Click the Save button at the bottom of the sidebar to save your changes.
Terms
Use this setting to assign a fixed term to the posts.
- Click the Add icon at the bottom right of the terms setting.
- Type the name of the term you want to assign.
- Select the matching term from the dropdown list.
- Repeat this process for each term you want to assign.
- Click the Save button at the bottom of the sidebar to save your changes.
Post Parent ID
Set this to parent post ID this child post belongs to. Leave blank for none.
Comment Status
Select whether the post can accept comments.
Ping Status
Select whether the post can accept pings.
Date
Enter the date of the post. Leave blank for current time.
Password
The password to access the post. Leave blank for none.
Update Previous Post
If you have two post management actions that are both related to the same WordPress post type, WS Form will by default update the previous post created / updated. Uncheck this if you want to create a fresh post with the second action.
Expose Post to Other Actions
If checked the newly created WordPress post data will be available in #post variables for use in other actions.