Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save travislopes/ec5fdff19b1f0a04217a07ac42bb9d14 to your computer and use it in GitHub Desktop.
Save travislopes/ec5fdff19b1f0a04217a07ac42bb9d14 to your computer and use it in GitHub Desktop.
<?php
/**
* Sort forms in Gravity Forms block in alphabetical order.
*
* @param array $forms A collection of active forms on site.
*/
add_filter( 'gform_block_form_forms', function( $forms ) {
usort( $forms, function( $a, $b ) {
return strcmp( $a['title'], $b['title'] );
} );
return $forms;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment