Duplicate Content Issue with WordPress Permalink Structure and Primary Categories

function get_current_post_ID() {
    $postid = get_queried_object_id();
    $post_url = get_permalink( $postid );
    //wp_redirect( $post_url );
    if( has_category('', $postid) && urldecode('https://'.$_SERVER ['HTTP_HOST'].$_SERVER ['REQUEST_URI']) != $post_url ) :
        wp_redirect( $post_url, 308 );
        exit();
    endif;
}
add_action( 'template_redirect', 'get_current_post_ID' );

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