Sort array by custom string value and number
// sort function function wpd_last_name_sort( $a, $b ) { $a_last = end(explode(‘ ‘, $a->post_title)); $b_last = end(explode(‘ ‘, $b->post_title)); return strcasecmp( $a_last, $b_last ); } function wpd_menu_order_sort( $a, $b ) { $a_last = $a->menu_order; $b_last = $b->menu_order; return $a_last > $b_last; } // sort posts $menu_order_tags = [ ‘cardiothoracic-surgery’, …