Related posts widget – category

Change function widget() as below

    global $post;

    // Get array of category ID's from current Post
    $post_categories = wp_get_post_categories( $post->ID );

    // Get array of post info.
    if(isset($post_categories) && is_array($post_categories) && count($post_categories) > 0){
        $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $post_categories);    
    } else {
        $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"]);    
    }

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