Sort posts in a specific way

This is possible with native query parameters like this:

$posts = get_posts([
    'post__in' => [2,5,3,1,4,6],
    'orderby   => 'post__in',
]);

This combination will instruct WP to fetch specific posts by ID and order them in the specific way that you supplied IDs.

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