WordPress. 有用的引擎配置技巧,你可能不知道
January 25, 2016
本教程将介绍10个 WordPress配置技巧 这可能对你的 website.
‘wp-config.php’ 文件是整个WordPress安装中最重要的文件. 此文件可用于提高您的 website, enhance performance and configure database functionalities.
-
一个有用的技巧 ‘wp-config.php’ 文件是检测的能力 database host:
定义(DB_HOST, _ENV美元{DATABASE_SERVER});
将上面的代码粘贴到 ‘wp-config.php file’ 它很可能会抓住 database server. 为此,您必须手动编辑 ‘wp-config.php’ file though.
-
WordPress可以自动查找一些 common database problems and repair them. WordPress也可以尝试优化 database. This improves performance in some situations. 要启用该特性,您需要使用以下命令 function:
定义(“WP_ALLOW_REPAIR”,真正的);
-
You can 定义文件系统方法 在服务器端使用:
定义(“FS_METHOD”、“直接”);
FS_METHOD Constant强制使用文件系统方法. It should only be ‘direct’, ‘ssh2’, ‘ftpext’, or ‘ftpsockets’. 一般来说,只有在遇到这种情况时才应该更改 update problems.
-
For developers, WordPress提供了调试功能,允许他们找到错误和弃用的功能. By default, this function 设置为false,但在开发模式下:
define(‘WP_DEBUG’, true); // enable debugging mode
-
在“WordPress设置”中设置WordPress地址和站点地址. 这些都在你的 database,并且每次开发人员在模板中调用它时,它都在运行 database query. 在你的 ‘wp-config.php’ 文件,你是在减少数量 database 查询从而增加您的网站 performance:
定义(“WP_HOME”、“http://info.template-help.com/help'); 定义(“WP_SITEURL”、“http://info.template-help.com/help');
-
You can override file permissions,如果您的主机对所有用户文件都有限制权限:
define('FS_CHMOD_FILE', 0755); // sets permissions on files define('FS_CHMOD_DIR', 0644); // sets permissions on folders
-
默认的WordPress 每60秒保存一次, 但如果你觉得这太过分了, 然后你可以用下面的配置来修改它:
define('AUTOSAVE_INTERVAL', 100); // in seconds
-
By default the trash feature WordPress的每个页面都清空了自己 30 days. 您可以使用以下命令修改它 function:
define('EMPTY_TRASH_DAYS', 10 ); //Where 10 is the amount of days
-
如果你不喜欢 trash feature,您可以通过添加 function below:
define('EMPTY_TRASH_DAYS', 0);
-
有一个常见的WordPress 内存耗尽错误 用户在激活时看到的 plugin. You can increase the PHP Memory Limit through ‘wp-config.php’ file. 只需粘贴下面的代码:
定义(' WP_MEMORY_LIMIT ', ' 64 ');
Note: 此功能可能不适用于某些web主机,因此您必须询问您的 hosting 提供程序来增加PHP Memory limit on their end.