Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

Developer DocumentationResources
How to Use Formidable Hooks

How to Use Formidable Hooks

Where to put the code

Any time you add a custom PHP function to your site, insert it in the WPCode plugin for code snippets (recommended), a child theme's functions.php, or your custom plugin.

IMPORTANT: Before making any PHP changes, ensure you have FTP access so you can still access your site if there are any mistakes in your code.

If you insert PHP code using the WPCode plugin, ensure that the PHP Snippet is selected as the code type. Formidable Hooks - WPCode snippet

If you're unfamiliar with using WordPress filters, you can find more details in the WordPress docs.

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

Duplicating a function

If you are attempting to use the same function or hook multiple times, you can't just duplicate the code and change field ids. Using the same function name twice will result in fatal errors on your site. To avoid this issue, you must change the function name any time you use the same code more than once on your site.

The function name is typically in two places within the code and needs to be changed in both places it occurs. In this example, the function name "check_entry_count" would need to be changed to something unique like "check_entry_count2" or "check_formb_entry_count". As long as the function names are unique, you can use the same custom code multiple times.

add_action('frm_display_form_action', 'check_entry_count', 8, 3);
function check_entry_count($params, $fields, $form){
	global $user_ID;
	remove_filter('frm_continue_to_new', '__return_false', 50);

	if($form->id == 11 and !is_admin()){ //replace 5 with the ID of your form
		$count = FrmEntry::getRecordCount("form_id=". $form->id ." AND user_id=".$user_ID);
		if($count >= 1){ //change 2 to your entry limit
			echo 'This form is closed';
			
			add_filter('frm_continue_to_new', '__return_false', 50);
		}
	}
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms