Specify strict ‘order by’ in WordPress query
You could use usort(). Your callback function would need to determine the last names and sort by them. So, for instance: $args = array( ‘post_type’ = ‘Employees’, ); $employees = get_posts( $args ); usort( $employees, ‘wp91501_sort_employees’ ); and then your callback might be: function wp91501_sort_employees( $a, $b ) { // split the names into arrays … Read more