重力形成api get_entries限制为20

时间:2016-09-03 16:52:57

标签: wordpress plugins gravity-forms-plugin

这似乎是一个非常简单的问题,但无论我如何切片,Gravity Forms只显示20个条目,即使GFAPI :: count_entries()返回52。

以下是代码:

$form_id=16; 
$search_criteria = array( 'status' => 'active' );
$total_entries = GFAPI::count_entries( $form_id, $search_criteria );
echo '<h3>Count of entries: '.$total_entries.'</h4>';
// shows: Count of entries: 52 as expected

// great, now process each entry and get specific fields
$paging = array( 'offset' => 0, 'page_size' => 60 );
$allentries = GFAPI::get_entries( $form_id, $paging );
echo '<h3>Count of entries: '.count($allentries).'</h4>';
// shows: Count of entries: 20

$entryid = 25; // known data item
$firstEntry = GFAPI::get_entry( $entryid );
echo '<h4>Name for 25: '.$firstEntry[20].'</h4>';
// shows: Name for 25: Todd

$entryid = 189; // known data item
$midEntry = GFAPI::get_entry( $entryid );
echo '<h4>Name for 189: '.$midEntry[20].'</h4>';
// shows: Name for 189: Steve

$entryid = 525; // known data item
$lastEntry = GFAPI::get_entry( $entryid );
echo '<h4>Name for 525: '.$lastEntry[20].'</h4>';
// shows: Name for 525: Graylin

我添加了$ page参数,$ search等,没有任何效果......我只提交了最后20条记录。

我的目标是在条目中循环获取特定字段(例如,firstname = [20]等)。

非常欣赏这里的方向。

1 个答案:

答案 0 :(得分:3)

试试这个:

$entries = GFAPI::get_entries( $form_id, $search_criteria, null, $paging );