Table of Contents
By default, the HomeRunner plugin sorts properties using menu_order DESC
. If you want to control the order manually, here’s how you can override this behavior.
Step 1: Disable HomeRunner Menu Order Sync #
Add the following filter to stop HomeRunner from updating the menu_order
field automatically:
add_filter('homelocal_property_update_postdata', function($postdata, $central_id, $post_id){
unset($postdata['menu_order']);
return $postdata;
}, 10, 3);
Step 2: Use a Sorting Plugin #
Install a WordPress plugin that allows you to customize sorting for posts/properties (for example, one that lets you drag and drop post order).
Step 3: Override Default Menu Order #
Finally, add this snippet to force ascending order instead of the default descending:
add_filter( 'posts_clauses', function( $clauses, $wp_query ) {
global $wpdb;
if ( isset( $clauses['orderby'] ) && strpos( $clauses['orderby'], "{$wpdb->posts}.menu_order DESC" ) !== false ) {
$clauses['orderby'] = str_replace(
"{$wpdb->posts}.menu_order DESC",
"{$wpdb->posts}.menu_order ASC",
$clauses['orderby']
);
}
return $clauses;
}, 20, 2 );