How to require a config file in a template and in function.php?

It is depends on where your config.php file is located. Write code in active theme’s functions.php

  1. If file is on root of WordPress installtion:
    require_once(ABSPATH .'config.php');

  2. If it is on active Theme’s root directory: require_once('config.php');

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