spivurno
7/11/2017 - 8:09 PM

Gravity Wiz // Gravity Forms // Get Form ID by Form Name

Gravity Wiz // Gravity Forms // Get Form ID by Form Name

<?php
/**
 * Gravity Wiz // Gravity Forms // Get Form ID by Form Name
 *
 * @param $name string The name of the form.
 *
 * @return int The form ID.
 */
function gw_get_form_id_by_name( $name ) {
	global $wpdb;
	$form_id = $wpdb->get_var( $wpdb->prepare( 'select id from wp_rg_form where title = \'%s\'', $name ) );
	return (int) $form_id;
}