get_posts empty when called via Ajax

To get data from AJAX call you have to echo or print it. In WordPress you should use wp_send_json() function to send data as response to call.

function mh_get_addons( $args = array() )   {

    $defaults = array(
        'posts_per_page' => -1,
        'orderby'        => 'post_title',
        'order'          => 'DESC',
        'post_type'      => 'mh-addon',
        'post_status'    => 'publish'
    );

    $args = wp_parse_args( $args, $defaults );
    $addons = get_posts( $args );
    wp_send_json( apply_filters( 'mh_get_addons', $addons ) );

} // mh_get_addons

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