Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created November 17, 2025 20:07
Show Gist options
  • Select an option

  • Save propertyhive/08ddb92b111414c46f0fe6e7941dda6c to your computer and use it in GitHub Desktop.

Select an option

Save propertyhive/08ddb92b111414c46f0fe6e7941dda6c to your computer and use it in GitHub Desktop.
Order student search by custom _pppm field when ordering by price
add_filter( 'propertyhive_get_search_results_ordering_args', 'order_students_by_pppm' );
function order_students_by_pppm($args)
{
if (
( !isset($_REQUEST['department']) && get_option( 'propertyhive_primary_department', '' ) == 'student' )
||
( isset($_REQUEST['department']) && $_REQUEST['department'] == 'student' )
)
{
// if searching student properties
if ( isset($args['meta_key']) && $args['meta_key'] == '_price_actual' )
{
// change to _pppm field
$args['meta_key'] = '_pppm';
}
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment