Skip to content

Commit 77c9b5a

Browse files
committed
added form filter to a transient
1 parent 24d6882 commit 77c9b5a

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

classes/class-cpt-wplf-submission.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,21 @@ function form_filter_dropdown() {
114114
return;
115115
}
116116

117-
// TODO: put this in a transient
118-
$forms = get_posts( array(
119-
'post_per_page' => '-1',
120-
'post_type' => 'wplf-form',
121-
) );
117+
$transient = get_transient("wplf-form-filter");
118+
119+
if($transient){
120+
$forms = $transient;
121+
}
122+
123+
else{
124+
$forms = get_posts( array(
125+
'post_per_page' => '-1',
126+
'post_type' => 'wplf-form',
127+
) );
128+
129+
set_transient("wplf-form-filter", $forms, 15 * MINUTE_IN_SECONDS);
130+
}
131+
122132
?>
123133
<label for="filter-by-form" class="screen-reader-text">Filter by form</label>
124134
<select name="form" id="filter-by-form">

0 commit comments

Comments
 (0)