The argument is orderby
not order_by
but I am not sure what sort_by
is. If that is a custom meta field you need to alter the query.
‘meta_value’ – Note that a ‘meta_key=keyname’ must also be present in
the query. Note also that the sorting will be alphabetical which is
fine for strings (i.e. words), but can be unexpected for numbers (e.g.
1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, 56 as you might
naturally expect). Use ‘meta_value_num’ instead for numeric values.
You need to pass one argument for the meta_key and another for the orderby
.
$args = array(
'post_type' => 'teacher',
'posts_per_page' => 30,
'meta_key' => 'sort_by',
'orderby' => 'meta_value',
'order'=>'ASC'
);