Its wired, i've try to order a custom post type simply by title, and still struggle. Of cause i checkt the dWP dev resources and much more. See always the same solutions, but its not working. Maybe I have something around that is the problem.
$args = array(
'post_type' => 'my-ctp-name',
'post_status' => 'publish',
'post_parent' => 0, // show only parents, is needed for my task
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
// Also testes with
// 'orderby' => array( 'title' => 'ASC' ),
// 'orderby' => array( 'post_title' => 'ASC' )
);
$query = new WP_Query($args);
if( $query->have_posts() ){
while( $query->have_posts() ){
$query->the_post();
get_template_part( 'template-parts/archive/archive', get_post_type() );
}
}else{
get_template_part( 'template-parts/content/content', 'notfound' );
}
wp_reset_query();