Skip to content

Instantly share code, notes, and snippets.

@mainiomooses
Last active November 13, 2023 16:11
Show Gist options
  • Save mainiomooses/a9b13752cad83b8ea6e76ceff02c50f6 to your computer and use it in GitHub Desktop.
Save mainiomooses/a9b13752cad83b8ea6e76ceff02c50f6 to your computer and use it in GitHub Desktop.
GFAPI::get_entries usage with is_read and is_starred field filters alongside other filters
<?php
// Correct way to use "is_read" and/or "is_starred" with GFAPI::get_entries
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
'mode' => 'all',
array(
'key' => '8',
'value' => 'abc',
),
array(
'key' => 'is_read',
'value' => 1,
),
)
);
$paging = array(
'offset' => 0,
'page_size' => 0
);
// Now returns results with field id 8 having value "abc" and only if the entry has been marked read
$entries = GFAPI::get_entries( 32, $search_criteria, null, $paging );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment