用于编辑wp-config.php的函数

时间:2015-07-29 作者:Greeso

I am writing a plugin in which I have to start by setting it up before using it. This means I may need to update wp-config.php

I know how to edit wp-config.php directly. However the requirement is to also be able to modify it via the plugin settings page. Once the user chooses the correct settings and saves, those settings are updated (added or modified) in wp-config.php

So is there a WordPress method that allows me to find the wp-config file? Is there a WordPress method or API that allows me to update the wp-config.php file? Is there a method that allows me to find and read then edit the wp-config.php entries?

Thanks.

1 个回复
SO网友:denis.stoyanov

通常使用正确的服务器配置wp配置。php文件不能从主题或插件编辑。它通常在插件/主题文件之前首先启动。Here is a similar discussion on the topic.

结束

相关推荐

从Options表中的数据创建阵列

大家好,我正试图从wordpress的选项表中的数据创建一个数组。我的数据都以相同的方式开始,然后是字段信息的名称。有没有办法提取所有这些数据并使用WordPress命令创建数组?或者,唯一的方法是使用适当的“SQL查询”,我想很多人都说在WordPress中不要这样做?