Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example code for cf_entry_limiter_entry_limit filter. See: https://calderaforms.com/doc/cf_entry_limiter_entry_limit/
<?php
/**
* Allow different field values of same field to have different limits when using Caldera Forms Entry Limitter
*
* Requires version 1.2.0 or later
*/
add_filter( 'cf_entry_limiter_entry_limit', function( $limit, $entry, $field, $form ){
//IMPORTANT: Change fld_9970286 to your field's ID
if( 'fld_9970286' === $field[ 'ID' ] ){
//IMPORTANT: Use the field values (not labels) in these conditionals
//change max entries for frisbee to 10
if( 'frisbee' === $entry ){
$limit = 10;
}elseif ( 'video-games' === $entry ){
$limit = 10;
}else{
$limit = 12;
}
}
return $limit;
}, 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.