Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Heffron bheffron

View GitHub Profile
@psaikali
psaikali / acf-gravity-forms-field.php
Created Jan 4, 2019
Populate ACF select field options with Gravity Forms to select a specific form
View acf-gravity-forms-field.php
<?php
/**
* Populate ACF select field options with Gravity Forms forms
*/
function acf_populate_gf_forms_ids( $field ) {
if ( class_exists( 'GFFormsModel' ) ) {
$choices = [];
foreach ( \GFFormsModel::get_forms() as $form ) {
$choices[ $form->id ] = $form->title;