I'm trying to use the toolset search for listings with certain field values (for example _listing_city = Denver) and have the view display the results of the search. I understand that the toolset views search only searches the content and the title of a post but if I could insert the custom field values into the content of the post then it would be indexable right? The problem is when I add fields to the content template they are not technically part of the content of the post (or the search is just ignoring that particular part of the content). so is there a way that I can put that info into the content so that it can be indexed in my search?
Dear chance,
Yes, it is possible with Relevanssi plugin+ Views plugin, see our document:
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/
section "Including custom fields in the search"
The fields I'm searching for are not types fields there from another plugin so I can't check the use in custom search box
You can try to convert this custom field under Types control, see our document
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/
section "Converting custom fields"
The fields are not listed in there. All of the fields start with _listing_ so they could be hidden?
Yes, you are right, it is expected result, Types plugin can not control those hidden field, which field slug starts with "_". If you agree, we can take it as a feature request. our developers will evaluate it.
Yes, that should be a feature, but is there any workaround for the meantime. Is there any way I could make types filed have the same value as the hidden field like _listing_price = listing_price or something like that?
It is not recommended to use Types plugin to control or make the hidden field, it will conduct other unexpected problems, you can check the source code of Types plugin, file "types\library\toolset\types\embedded\classes\field\definition_factory_post.php", line 31~3:
$meta_keys = $wpdb->get_col(
"SELECT meta_key FROM {$wpdb->postmeta} GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY meta_key"
);
As you can see, we avoid to display those hidden fileds in the "Post Field Control" page.
And there isn't such a built-in feature with Types plugin:
"have the same value as the hidden field like _listing_price = listing_price"
But you can try with wordpress built-in action hook "save_post" to achieve what you want:
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
For example, when a user edit a post, use action hook "save_post" to trigger a PHP function, in this PHP function, do these:
1) get the custom filed "_listing_price" value
https://developer.wordpress.org/reference/functions/get_post_meta/
2) Save it to another field "listing_price"
https://developer.wordpress.org/reference/functions/update_post_meta/