{"id":60834,"date":"2016-01-25T03:22:24","date_gmt":"2016-01-25T08:22:24","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=60834"},"modified":"2017-08-15T06:53:47","modified_gmt":"2017-08-15T10:53:47","slug":"wordpress-useful-engine-configuration-tricks-that-you-may-not-know","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/wordpress-useful-engine-configuration-tricks-that-you-may-not-know.html","title":{"rendered":"WordPress. Useful engine configuration tricks that you may not know"},"content":{"rendered":"<p>\r\n<p>This tutorial will describe 10 <strong>WordPress Configuration Tricks<\/strong> that might be useful for your website.<\/p>\r\n<p><strong>&#8216;wp-config.php&#8217;<\/strong> file is the most important file in the entire WordPress installation. This file can be used to improve security on your website, enhance performance and configure database functionalities. <\/p>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/service-center\/\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-3-(835-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>\r\n<ol>\r\n<li>\r\n<p>One of the useful tricks for <strong>&#8216;wp-config.php&#8217;<\/strong> file is the ability to detect the database host:<\/p>\r\n<pre class=\"brush:php\">define('DB_HOST', $_ENV{DATABASE_SERVER});<\/pre>\r\n<p>Paste the code above into <strong>&#8216;wp-config.php file&#8217;<\/strong> and it will most likely grab the database server. For this, you will have to manually edit the <strong>&#8216;wp-config.php&#8217;<\/strong> file though.<\/p>\r\n<\/li>\r\n<li>\r\n<p>WordPress can automatically look for some <strong>common database problems<\/strong> and <strong>repair them<\/strong>. WordPress can also attempt to optimize the database. This improves performance in some situations. To enable this feature, you would need to use the following function:<\/p>\r\n<pre class=\"brush:php\">define('WP_ALLOW_REPAIR', true);<\/pre>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_1.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_1-300x240.png\" alt=\"WordPress_Useful_engine_configuration_tricks_1\" width=\"300\" height=\"240\" class=\"aligncenter size-medium wp-image-60835\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_1-300x240.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_1-150x120.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_1.png 780w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n\t<\/li>\r\n<li>\r\n<p>You can <strong>define the filesystem method<\/strong> to be used on the server:<\/p>\r\n<pre class=\"brush:php\">define('FS_METHOD', 'direct');<\/pre>\r\n<p><strong>FS_METHOD<\/strong> constant forces the filesystem method. It should only be <strong>&#8216;direct&#8217;<\/strong>, <strong>&#8216;ssh2&#8217;<\/strong>, <strong>&#8216;ftpext&#8217;<\/strong>, or <strong>&#8216;ftpsockets&#8217;<\/strong>. Generally, you should only change this if you are experiencing update problems.<\/p>\r\n<\/li>\r\n<li>\r\n<p>For <strong>developers<\/strong>, WordPress offers debugging feature which allows them to find errors and deprecated functions. By default, this function is set to false, but in the development mode:<\/p>\r\n<pre class=\"brush:php\"> define(&lsquo;WP_DEBUG&rsquo;, true); \/\/ enable debugging mode<\/pre>\r\n<\/li>\r\n<li>\r\n<p>In  WordPress Settings, you specify the WordPress address and the site address. Those are added in your database, and every time the developer calls it in the template, it is running a database query. By adding the line below in your <strong>&#8216;wp-config.php&#8217;<\/strong> file, you are reducing the number of database queries thus increasing your site\u2019s performance: <\/p>\r\n<pre class=\"brush:php\">\r\n\t\tdefine('WP_HOME',    'http:\/\/info.template-help.com\/help');\r\n\t\tdefine('WP_SITEURL', 'http:\/\/info.template-help.com\/help');<\/pre>\r\n<\/li>\r\n<li>\r\n<p>You can override <strong>file permissions<\/strong>, if your host has restrictive permissions for all user files:<\/p>\r\n<pre class=\"brush:php\">\r\n\t\tdefine('FS_CHMOD_FILE', 0755); \/\/ sets  permissions on files\r\n\t\tdefine('FS_CHMOD_DIR', 0644);  \/\/ sets  permissions on folders<\/pre>\r\n<\/li>\r\n<li>\r\n<p>By default WordPress <strong>saves post every 60 seconds<\/strong>, but if you think that is way too much, then you can modify it to your liking with this configuration:<\/p>\r\n<pre class=\"brush:php\">define('AUTOSAVE_INTERVAL', 100); \/\/ in seconds <\/pre>\r\n<\/li>\r\n<li>\r\n<p>By default the <strong>trash feature<\/strong> of WordPress empties itself every <strong>30<\/strong> days. You can modify that by using the following function:<\/p>\r\n<pre class=\"brush:php\">define('EMPTY_TRASH_DAYS', 10 ); \/\/Where 10 is the amount of days<\/pre>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_2.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_2-300x104.png\" alt=\"WordPress_Useful_engine_configuration_tricks_2\" width=\"300\" height=\"104\" class=\"aligncenter size-medium wp-image-60836\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_2-300x104.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_2-150x52.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/01\/WordPress_Useful_engine_configuration_tricks_2.png 817w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n\t<\/li>\r\n<li>\r\n<p>If you do not like <strong>trash feature<\/strong>,  you can disable it by adding the function below:<\/p>\r\n<pre class=\"brush:php\">define('EMPTY_TRASH_DAYS', 0 );<\/pre>\r\n<\/li>\r\n<li>\r\n<p>There is a common WordPress <strong>Memory Exhausted Error<\/strong> that users have seen when activating some plugin. You can <strong>increase the PHP Memory Limit <\/strong>through <strong>&#8216;wp-config.php&#8217;<\/strong> file. Simply paste the code below:<\/p>\r\n<pre class=\"brush:php\">define('WP_MEMORY_LIMIT', '64M');<\/pre>\r\n<p class=\"attention\"><strong>Note:<\/strong> This feature may not work with some web hosts, so you will have to ask your hosting provider to increase your PHP Memory limit on their end.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial will describe 10  <strong>WordPress Configuration Tricks<\/strong> that might be useful for your website.<\/p>\n","protected":false},"author":37,"featured_media":60837,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[728],"tags":[1090,563,2166,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/60834"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=60834"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/60834\/revisions"}],"predecessor-version":[{"id":82692,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/60834\/revisions\/82692"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/60837"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=60834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=60834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=60834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}