Skip to content

Instantly share code, notes, and snippets.

@jameslaws
Created November 18, 2015 13:59
Show Gist options
  • Save jameslaws/a9318c140a56c50f440a to your computer and use it in GitHub Desktop.
Save jameslaws/a9318c140a56c50f440a to your computer and use it in GitHub Desktop.
Ninja Forms - Get all form IDs and Names
<?php
$forms = Ninja_Forms()->form()->get_forms();
foreach ( $forms as $form ) {
$form_id = $form->get_id();
$form_name = $form->get_setting( 'title' );
// Do more stuff
}
@manchumahara
Copy link

manchumahara commented Feb 5, 2018

$forms_modified = array();

				if ( get_option( 'ninja_forms_load_deprecated', false ) ) {
					$forms = Ninja_Forms()->forms()->get_all();

					foreach ( $forms as $form_id ) {
						$forms_modified[ $form_id ] = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );;
					}
				} else {
					$forms = Ninja_Forms()->form()->get_forms();
					foreach ( $forms as $index => $form ) {
						$forms_modified[ $form->get_id() ] = $form->get_setting( 'title' );
					}
				}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment