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

后端 未结 7 1037
悲哀的现实
悲哀的现实 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:14

    I would just include the file then I would have access to the variable in it varibales.

    
    

    This is assuming you're on the same server and you can access wp-config.php through the file system.

    If you're doing this for a plugin, these values are already available. You won't need to include the file again.

提交回复
热议问题