Forked from travislopes/gform_block_form_forms_alphabetical.php
Created
July 27, 2021 19:01
-
-
Save elpuas/9f658e608747652a0d541d9a6316711d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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