Help Center
How to Add Posts Related to User to Form Field

How to Add Posts Related to User to Form Field

In this tutorial, you will learn how to show related posts to the current user in the form.

Before you start, check the tutorial requirements:

Warning

For this case, you already need to have a relation created between users and posts.

parent users editing window

Create Query

When attaching posts to users, go to WordPress Dashboard > JetEngine > Query Builder.

Press the “Add New button to create a Posts Query.

Choose the needed Query Type in the General section and go to the Post&Page section.

Here, search for the Post In field, hit the dynamic tags button next to it, and select the “Related Items” option. 

Pick the needed item in the From Relation field, set a “Child Object” (because we will show the posts list) as From object (what to show), and sort by the “Current User ID,” which can be selected in the Initial Object ID From (get initial ID here) field.

post and page section and post in field customization

Build Form

The new step is to create a form, so head to WordPress Dashboard > JetFormBuilder > Add New.

Once the editor is opened, add a Select Field. If you click on the new field, you will see several fields for customization.Choose the “Generate Dynamically” option in the Fill options from list, and the Generator function field will appear. Here, pick the “Get values list from JetEngine Query” option and specify the Field name — in the described case, it is “47|ID|post_title” where “47” is a Query ID.

Warning

Change “47” into the ID of the query you use.

generate dynamically options for a select field in jetformbuilder form

Add Form to Page

Go to the page, find the JetForm widget in the sidebar and drag-n-drop it to the page. 

Choose your form in the corresponding field, and customize it according to your needs.

jetform form settings in elementor

Check Results

That’s all, now you can open your page and check posts related to your user.

select field with query options on the front end

Here is the result; now you know how to add WordPress posts related to the user to a JetFormBuilder form by using the JetEngine plugin.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.