Skip to content

Instantly share code, notes, and snippets.

@cfxd
Created November 13, 2014 17:49
Show Gist options
  • Save cfxd/87067f475e1f2c6fc172 to your computer and use it in GitHub Desktop.
Save cfxd/87067f475e1f2c6fc172 to your computer and use it in GitHub Desktop.
Populate Gravity Forms in an ACF select field named "subscribe_form_header"
<?php
function populate_gravity_forms($field) {
if(class_exists('RGFormsModel')) {
$forms_array = array();
$forms = RGFormsModel::get_forms(null, 'title');
foreach($forms as $form) {
$forms_array[$form->id] = $form->title;
}
$field['choices'] = $forms_array;
}
return $field;
}
add_filter('acf/load_field/name=subscribe_form_header', 'populate_gravity_forms');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment