Skip Navigation

[Resolved] Populating search value from custom post

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1092503

Tell us what you are trying to do?

I have a custom post type created called "Property". As part of the content template I want to create a search with an automatically populated field (property-id) that pulls the value from the current post that is being displayed. Is this possible?

What is the link to your site?

hidden link

#1092835

Hello,

I suggest you try the WordPress built-in post ID field, which is also a unique value, for example, you can display current property post ID with Views shortcode [wpv-post-id]:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-id

#1093242

That's great. How do I now add that in as a pre-defined value in a search form?

#1093660

Hello,

I assume you are using shortcode [wpv-control-postmeta] to display the field in search form, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta

There isn't such an option to "add that in as a pre-defined value in a search form".

As a workaround, you can pass URL parameter to the view, for example:
hidden link

It is passing URL parameter "wpv-wpcf-property-id", value 20, see it in the field "Property ID", it is populated with value 20