How do I read values (PHP defined constants) from wp-config.php?

后端 未结 7 1048
悲哀的现实
悲哀的现实 2021-02-07 03:40

I need to get username, password etc from the wp-config file to connect to a custom PDO database.

Currently I have another file where I have this info, but

相关标签:
7条回答
  • 2021-02-07 04:25

    I have even defined my own constants in in wp-config.php and managed to retrieve them in theme without any includes.

    wp-config.php

    define('DEFAULT_ACCESS', 'employee');
    

    functions.php

    echo "DEFAULT_ACCESS :".DEFAULT_ACCESS;
    

    outputs DEFAULT_ACCESS :employee

    0 讨论(0)
提交回复
热议问题