This hook makes it so when an entry object is retrieved, like this:$entry = FrmEntry::getOne( $id, true)then the $entry->metas includes the field values by ID and also by key.Normally when retrieving an entry object, the $entry->metas would only include the field values by ID.
Usage
add_filter('frm_include_meta_keys', 'include_meta_keys_for_single_form', 10, 2);
Parameters
- $include_keys (boolean) - true or false
- $args (array)
- 'form_id' (int)
Examples
Basic Example
This will include item meta keys for all forms on your site.
add_filter('frm_include_meta_keys', '__return_true');
Enable Meta Keys for Single Form
This example will allow you to include item meta keys for entries belonging to a single form.
add_filter('frm_include_meta_keys', 'include_meta_keys_for_single_form', 10, 2); function include_meta_keys_for_single_form( $include_keys, $args ) { if ( $args['form_id'] == 364 ) { //replace 364 with Form ID $include_key = true; } return $include_key; }
If you would like to add your own example, click here.
Change Log
Last changed in version 2.0.07
Have something to add?
Click here to provide feedback on this page.