Using frm_entries_list_query for all the entries from one form

By: Helen M | Asked: 09/16/2024
ForumsCategory: Code SnippetsUsing frm_entries_list_query for all the entries from one form
Helen M asked 3 weeks ago
I'm trying to make it so that the entries for a particular form aren't included in the entries tab on the back end (I still want them to be stored for a view so don't want to delete them). I've found this php code and will add it to my functions.php child theme file but this particular code applies only to limiting specific entry ids. Does anyone with better knowledge of PHP than me know how to get it to apply to all entries for that particular form (id: 3)? Thank you so much in advance. Helen   Here is the code that I've been trying:
Start your code here add_filter( 'frm_entries_list_query', 'set_listed_entries_journal', 10,2 );
function set_listed_entries_journal( $where, $atts ) {
$form_id = 3; // set to your form id
if ( $atts['form_id'] == $form_id && ! current_user_can('administrator') ) { // who should not see the form?
$where['it.id !'] = array( 4, 6 ); // replace 4, 6 with your entry ids
}
return $where;
}

And here's where I got it from: https://formidableforms.com/knowledgebase/frm_entries_list_query/
1 Answers
Rob LeVineRob LeVine answered 3 weeks ago
The code already does act on a particular form (3 in your example). So you need to change the code inside the if statement. The easiest (albeit a little hokey) way is to change the line to $where['it.id '] = array( -1 );. Assuming that your form_id is correct, that will try to show only entries with the id of -1, which won't exist.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right