Modify default Related Posts Code to Custom Post Type

Assuming your CPT is ‘videos’ you’d use:

// Build the query
    $args = array(
        'post_type' => 'videos',
        'posts_per_page' => '4',
        'cat' => $cat_id
    );

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