Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GravityView - Sort by Address field when sorting by full address
// Modify sorting when sorting full address
add_filter( 'gravityview/sorting/address', 'modify_gravityview_address_sorting', 10, 3 );
* Override how to sort when sorting address
* @since 1.8
* @param string $address_part `street`, `street2`, `city`, `state`, `zip`, or `country` (default: `city`)
* @param string $sort_field_id Field used for sorting
* @param int $form_id GF Form ID
function modify_gravityview_address_sorting( 'city', $sort_field_id, $form_id ) {
// Change below to any of the allowed options: street, street2, city, state, zip, country
return 'street';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment