# advanced-forms/trunk/api/api-entries.php

Advanced Forms for ACF, version trunk. 53 lines.

- Page: https://pluginprobe.com/plugins/advanced-forms/trunk/code/api/api-entries.php
- Raw: https://pluginprobe.com/plugins/advanced-forms/trunk/raw/api/api-entries.php
- Modified: 2016-11-24T19:59:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/advanced-forms/trunk/code/api/api-entries.php#L10-L20`.

```php
<?php


/**
 * Gets all entries for the specified form
 *
 * @since 1.0.0
 *
 */
function af_get_entries( $form_key ) {

	$args = array(
		'post_type' => 'af_entry',
		'posts_per_page' => '-1',
 		'meta_query' => array(
	 		array(
		 		'key' => 'entry_form',
		 		'value' => $form_key,
	 		),
 		),
	);

	$query = new WP_Query( $args );

	return $query->posts;

}


/**
 * Get number of entries by form
 *
 * 1.0.2
 *
 */
function af_get_entry_count( $form_key ) {
	
	$args = array(
		'post_type' => 'af_entry',
		'posts_per_page' => '-1',
 		'meta_query' => array(
	 		array(
		 		'key' => 'entry_form',
		 		'value' => $form_key,
	 		),
 		),
	);

	$query = new WP_Query( $args );
	
	return $query->found_posts;
	
}
```
