Sort Posts Alphabetically by Multiple Categories [duplicate]

Use the orderby and order parameters in the argument list. See the Orderby_Parameters section of WP_Query for details.

$category_ids = $arr_records = $post_data = array();

$categories = get_categories( 'child_of=4' );
foreach( $categories as $category ) {
    $category_ids[] = $category->term_id;
}

$post_data = get_posts( array(
    'cat'     => $category_ids,
    'orderby' => 'title',
    'order'   => 'ASC',
) );

$post_data should now be sorted by post title [A-Z].

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)