{"id":14787,"date":"2021-10-13T07:38:00","date_gmt":"2021-10-13T07:38:00","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=14787"},"modified":"2026-03-10T10:06:53","modified_gmt":"2026-03-10T10:06:53","slug":"how-to-use-wp-config-php-wordpress-function","status":"publish","type":"post","link":"\/my\/tutorials\/wp-config-php","title":{"rendered":"Everything you need to know about wp-config.PHP"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>The <strong>wp-config.php<\/strong> file is a significant part of a WordPress installation. Created during the WordPress installation process, the file contains database configuration items. In short, it allows WordPress to establish a connection with the database.<\/p><p>That said, a webmaster should know how to manage it properly to ensure the site&rsquo;s security. Without it, your WordPress site wouldn&rsquo;t be able to store and retrieve data from its database.<\/p><p>This article will explore the functionality of the <strong>wp-config.php<\/strong> file and how to locate it in your WordPress site&rsquo;s directory. We will also show you how to edit the <strong>wp-config.php<\/strong> file and implement custom settings on your website.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download all in one WordPress cheat sheet<\/a><\/p><p>\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-the-wp-config-php-file\">What Is the wp-config.php File<\/h2><p>The <strong>wp-config.php <\/strong>file is a configuration file created during the <a href=\"\/my\/tutorials\/how-to-install-wordpress\">WordPress installation<\/a> process. It stores database information such as the database name, username, password, and host.<\/p><p>In addition to establishing a connection between your WordPress site and its database, WordPress also uses the <strong>wp-config.php <\/strong>file to implement advanced settings on the site.<\/p><p>This configuration file is stored within the root folder of your website. Access the <strong>wp-config.php <\/strong>file via an FTP client like <a href=\"https:\/\/filezilla-project.org\/\" target=\"_blank\" rel=\"noopener\">FileZilla<\/a> or your web host&rsquo;s File Manager. The following example shows the <strong>wp-config.php <\/strong>file in the <strong>\/public_html <\/strong>directory:<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-wpconfig-selected.png\"><img decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-wpconfig-selected-1024x355.png\" alt=\"The wp-config.php file on Hostinger's file manager\" class=\"wp-image-79642\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected-300x104.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected-150x52.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-wpconfig-selected-768x266.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>In case you need to create the <strong>wp-config.php <\/strong>file manually,<strong> <\/strong>WordPress provides a <a href=\"https:\/\/github.com\/WordPress\/WordPress\/blob\/master\/wp-config-sample.php\" target=\"_blank\" rel=\"noopener\">sample file<\/a> called the <strong>wp-config-sample.php <\/strong>file within the root folder.<\/p><p>It contains all the necessary information, ideal for <a href=\"\/my\/tutorials\/wordpress\">WordPress beginners<\/a> who aren&rsquo;t familiar with the file yet. Keep in mind not to change the order of the code as it may cause errors on the site.<\/p><p>Here&rsquo;s the content of the <strong>wp-config.php <\/strong>sample<strong> <\/strong>file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/**\n* The base configuration for WordPress\n*\n* The wp-config.php creation script uses this file during the\n* installation. You don't have to use the web site, you can\n* copy this file to \"wp-config.php\" and fill in the values.\n*\n* This file contains the following configurations:\n*\n* * MySQL settings\n* * Secret keys\n* * Database table prefix\n* * ABSPATH\n*\n* @link https:\/\/wordpress.org\/support\/article\/editing-wp-config-php\/\n*\n* @package WordPress\n*\/\n\n\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\n\n\/** The name of the database for WordPress *\/\ndefine( 'DB_NAME', 'database_name_here' );\n\n\/** MySQL database username *\/\ndefine( 'DB_USER', 'username_here' );\n\n\/** MySQL database password *\/\ndefine( 'DB_PASSWORD', 'password_here' );\n\n\/** MySQL hostname *\/\ndefine( 'DB_HOST', 'localhost' );\n\n\/** Database Charset to use in creating database tables. *\/\ndefine( 'DB_CHARSET', 'utf8' );\n\n\/** The Database Collate type. Don't change this if in doubt. *\/\ndefine( 'DB_COLLATE', '' );\n\n\/**#@+\n* Authentication Unique Keys and Salts.\n*\n* Change these to different unique phrases!\n* You can generate these using the {@link https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/ WordPress.org secret-key service}\n*\n* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.\n*\n* @since 2.6.0\n*\/\ndefine( 'AUTH_KEY',         'put your unique phrase here' );\ndefine( 'SECURE_AUTH_KEY',  'put your unique phrase here' );\ndefine( 'LOGGED_IN_KEY',    'put your unique phrase here' );\ndefine( 'NONCE_KEY',        'put your unique phrase here' );\ndefine( 'AUTH_SALT',        'put your unique phrase here' );\ndefine( 'SECURE_AUTH_SALT', 'put your unique phrase here' );\ndefine( 'LOGGED_IN_SALT',   'put your unique phrase here' );\ndefine( 'NONCE_SALT',       'put your unique phrase here' );\n\n\/**#@-*\/\n\n\/**\n* WordPress database table prefix.\n*\n* You can have multiple installations in one database if you give each\n* a unique prefix. Only numbers, letters, and underscores please!\n*\/\n$table_prefix = 'wp_';\n\n\/**\n* For developers: WordPress debugging mode.\n*\n* Change this to true to enable the display of notices during development.\n* It is strongly recommended that plugin and theme developers use WP_DEBUG\n* in their development environments.\n*\n* For information on other constants that can be used for debugging,\n* visit the documentation.\n*\n* @link https:\/\/wordpress.org\/support\/article\/debugging-in-wordpress\/\n*\/\ndefine( 'WP_DEBUG', false );\n\n\/* Add any custom values between this line and the \"stop editing\" line. *\/\n\n\/* That's all, stop editing! Happy publishing. *\/\n\/** Absolute path to the WordPress directory. *\/\nif ( ! defined( 'ABSPATH' ) ) {\n   define( 'ABSPATH', __DIR__ . '\/' );\n}\n\n\/** Sets up WordPress vars and included files. *\/\nrequire_once ABSPATH . 'wp-settings.php';<\/pre><p>WordPress uses PHP constants, which are identifiers for values that cannot be modified when executing a PHP script. These identifiers define the database settings within the <strong>wp-config.php <\/strong>file. Each setting comes with instructions, making it easier to use the code template.<\/p><h2 class=\"wp-block-heading\" id=\"h-where-is-the-wp-config-php-file-in-wordpress\">Where Is the wp-config.php File in WordPress<\/h2><p>To locate the PHP<strong> <\/strong>file within your WordPress site&rsquo;s root directory, either use the File Manager provided by your web hosting provider or an FTP client. The following section will show you how to find the <strong>wp-config.php <\/strong>file in <a href=\"\/support\/1583483-comprehensive-guide-to-hpanel-at-hostinger\/\">Hostinger&rsquo;s hPanel<\/a>, cPanel, and via FTP.<\/p><h3 class=\"wp-block-heading\" id=\"h-locating-the-wp-config-php-file-in-the-hpanel\">Locating the wp-config.php File in the hPanel<\/h3><p>Hostinger&rsquo;s File Manager provides access to all WordPress files, including <strong>wp-config.php<\/strong>. This method requires login credentials to your hosting dashboard. Here&rsquo;s how to locate the <strong>wp-config.php<\/strong> file in hPanel:<\/p><ol class=\"wp-block-list\">\n<li>Navigate to <strong>File Manager<\/strong> under the <strong>Files <\/strong>section of your hPanel.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-sidebar.png\"><img decoding=\"async\" width=\"448\" height=\"522\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-sidebar.png\" alt=\"The File Manager button on hPanel\" class=\"wp-image-80353\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-filemanager-sidebar.png 448w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-filemanager-sidebar-257x300.png 257w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-filemanager-sidebar-129x150.png 129w\" sizes=\"(max-width: 448px) 100vw, 448px\" \/><\/a><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Click on the <strong>public_html<\/strong> folder located in the sidebar.<\/li>\n\n\n\n<li>Scroll down until you find the <strong>wp-config.php <\/strong>file.<\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-locating-the-wp-config-php-file-in-cpanel\">Locating the wp-config.php File in cPanel<\/h3><p>cPanel also comes with a File Manager. Follow these steps to locate the <strong>wp-config.php<\/strong> file in cPanel:<\/p><ol class=\"wp-block-list\">\n<li>Navigate to <strong>File Manager<\/strong> under the <strong>Files <\/strong>section of your cPanel.<\/li>\n<\/ol><figure class=\"wp-block-image size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/cPanel-file-manager.png\"><img decoding=\"async\" width=\"1023\" height=\"418\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/cPanel-file-manager.png\" alt=\"File Manager on cPanel.\" class=\"wp-image-37708\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-file-manager.png 1023w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-file-manager-300x123.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-file-manager-150x61.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-file-manager-768x314.png 768w\" sizes=\"(max-width: 1023px) 100vw, 1023px\" \/><\/a><\/figure><ol start=\"2\" class=\"wp-block-list\">\n<li>Access the <strong>public_html<\/strong> &rarr; <strong>wp<\/strong> folder from the sidebar.<\/li>\n\n\n\n<li>Scroll down until you locate the <strong>wp-config.php <\/strong>file.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/cPanel-wp-config-php.png\"><img decoding=\"async\" width=\"1024\" height=\"476\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/cPanel-wp-config-php-1024x476.png\" alt=\"The wp-config.php file in the \/public_html directory on cPanel.\" class=\"wp-image-37709\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-wp-config-php-1024x476.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-wp-config-php-300x140.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-wp-config-php-150x70.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-wp-config-php-768x357.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/cPanel-wp-config-php.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-locating-the-wp-config-php-file-via-ftp\">Locating the wp-config.php File via FTP<\/h3><p>You may also use an FTP client to find the <strong>wp-config.php<\/strong> file. If you need help, we have a tutorial on <a href=\"\/my\/tutorials\/ftp\/filezilla-ftp-configuration\">how to configure FileZilla<\/a>.<\/p><p>Here&rsquo;s how to locate the <strong>wp-config.php<\/strong> file via an FTP client:<\/p><ol class=\"wp-block-list\">\n<li>Collect your FTP credentials from your hosting provider. If your website is running on Hostinger&rsquo;s <a href=\"\/my\/wordpress-hosting\">managed WordPress<\/a> or any other type of hosting services, this information is available in <strong>FTP Accounts<\/strong>, under the <strong>Files <\/strong>section of your hPanel. Alternatively, send an information request to your hosting provider.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-ftpaccounts.png\"><img decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-ftpaccounts-1024x684.png\" alt=\"FTP account details\" class=\"wp-image-79410\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-ftpaccounts-1024x684.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-ftpaccounts-300x201.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-ftpaccounts-150x100.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-ftpaccounts-768x513.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-files-ftpaccounts.png 1125w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"2\" class=\"wp-block-list\">\n<li>Open FileZilla and enter your FTP credentials. Click<strong> Quickconnect<\/strong>.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/FileZilla-connect.png\"><img decoding=\"async\" width=\"1024\" height=\"553\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/FileZilla-connect-1024x553.png\" alt=\"Entering FTP credentials: host, username, password, and port and clicking quickconnect.\" class=\"wp-image-37711\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-connect-1024x553.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-connect-300x162.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-connect-150x81.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-connect-768x415.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-connect.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"3\" class=\"wp-block-list\">\n<li>Navigate to the root directory of your site (<strong>public_html<\/strong>). The <strong>wp-config<\/strong> file should be there.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/FileZilla-wp-config-php.png\"><img decoding=\"async\" width=\"1024\" height=\"539\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/FileZilla-wp-config-php-1024x539.png\" alt=\"The wp-config.php file in the \/public_html directory on FileZilla.\" class=\"wp-image-37712\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-wp-config-php-1024x539.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-wp-config-php-300x158.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-wp-config-php-150x79.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-wp-config-php-768x405.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/FileZilla-wp-config-php.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-relocating-the-wp-config-php-file\">Relocating the wp-config.php File<\/h3><p>Since your WordPress website configuration file is stored within the root folder, the file becomes susceptible to malware attacks.<\/p><p>In addition to configuring file permissions, we recommend relocating the file from its default location to harden your WordPress website security.<\/p><p>Follow these steps to relocate the WordPress <strong>wp-config.php<\/strong> file using the File Manager:<\/p><ol class=\"wp-block-list\">\n<li>Locate your <strong>wp-config.php<\/strong> file in the root directory of your WordPress website.<\/li>\n\n\n\n<li>Copy and paste the <strong>wp-config.php<\/strong> file to another directory of your choice. In this example, we will put it inside <strong>\/public_html\/wp-admin\/user<\/strong>.<\/li>\n\n\n\n<li>Change the name of the new <strong>wp-config<\/strong> file. The goal is to disguise it as an unimportant file so hackers won&rsquo;t recognize it.<\/li>\n\n\n\n<li>Navigate back to the original <strong>wp-config<\/strong> file and replace its entire content with the following code:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\ninclude(&lsquo;\/domains\/yourdomain.com\/public_html\/wp-admin\/user\/new-wp-config.php&rsquo;);\n?&gt;<\/pre><p>Make sure to replace the directory with the file&rsquo;s new location, <strong>new-wp-config.php<\/strong> with your new file name, and add your own domain.<\/p><ol start=\"5\" class=\"wp-block-list\">\n<li>That&rsquo;s it. The original <strong>wp-config<\/strong> file will now serve as a shortcut that redirects your server to the actual <strong>wp-config <\/strong>file.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-the-wp-config-php-file-sections\">The wp-config.php File Sections<\/h2><p>As mentioned earlier, the WordPress <strong>wp-config-sample.php<\/strong> file can be modified to create a custom configuration for your WordPress website. Therefore, it&rsquo;s important to know the purpose of each section and how to change it.<\/p><p>This section will provide a breakdown of the sections within the <strong>wp-config <\/strong>file and code snippets to add for advanced WordPress website customization.<\/p><h3 class=\"wp-block-heading\" id=\"h-mysql-settings-for-wp-config-php\">MySQL Settings for wp-config.php<\/h3><p>The MySQL settings section consists of your <a href=\"\/my\/tutorials\/wordpress-database\">WordPress database<\/a> configuration &#8210; MySQL hostname, database name, username, and password. We recommend changing this section if your hosting provider uses an alternate port number or you&rsquo;re moving to a different web server.<\/p><p>Here&rsquo;s a snippet of the MySQL settings section taken from the <strong>wp-config-sample.php <\/strong>file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\n\n\/** The name of the database for WordPress *\/\ndefine( 'DB_NAME', 'database_name_here' );\n\n\/** MySQL database username *\/\ndefine( 'DB_USER', 'username_here' );\n\n\/** MySQL database password *\/\ndefine( 'DB_PASSWORD', 'password_here' );\n\n\/** MySQL hostname *\/\ndefine( 'DB_HOST', 'localhost' );<\/pre><p>All the information required by this section is available in your hosting control panel. For example, Hostinger displays the user&rsquo;s database information in <strong>MySQL Databases<\/strong> under the <strong>Databases <\/strong>section of the hPanel.<\/p><p>WordPress puts the name of your database within the <strong>DB_NAME<\/strong> variable upon installation.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-databases-management-listofcurrentmysqldatabases.png\"><img decoding=\"async\" width=\"1024\" height=\"411\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-databases-management-listofcurrentmysqldatabases-1024x411.png\" alt=\"The list of currently created MySQL databases on hPanel\" class=\"wp-image-81386\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-databases-management-listofcurrentmysqldatabases.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-databases-management-listofcurrentmysqldatabases-300x120.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-databases-management-listofcurrentmysqldatabases-150x60.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/hpanel-databases-management-listofcurrentmysqldatabases-768x308.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-database-character-sets\">Database Character Sets<\/h3><p>WordPress configures the database character set and database collation values in the configuration file. Its purpose is to define database tables with the appropriate charset settings, such as:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/** Database Charset to use in creating database tables. *\/\ndefine( 'DB_CHARSET', 'utf8' );\n\/** The Database Collate type. Don't change this if in doubt. *\/\ndefine( 'DB_COLLATE', '' );<\/pre><p>By default, WordPress assigns <strong>UTF8 <\/strong>as the default charset as it supports all internet-friendly languages, making it ideal for modern data.<\/p><p>Meanwhile, the value of the database collation mostly depends on the charset because it determines how the WordPress database sorts and compares your data.<\/p><p>MySQL automatically assigns the database collation value based on the assigned character set, hence the blank default value. If your WordPress database uses <strong>UTF8<\/strong>, then the default collation value is <strong>utf8_general_ci<\/strong>.<\/p><p>However, it&rsquo;s possible to <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/charset-unicode-sets.html\" target=\"_blank\" rel=\"noopener\">manually assign a collation value<\/a> if the language character set isn&rsquo;t the same as the ones being displayed, such as the Japanese language.<\/p><p>We recommend not modifying this section unless you have an excellent understanding of SQL, <a href=\"\/my\/tutorials\/what-is-mysql\">MySQL<\/a>, and MariaDB. Using the wrong combination of charset and collation values will cause various database errors in WordPress.<\/p><h3 class=\"wp-block-heading\" id=\"h-security-keys\">Security Keys<\/h3><p>Your <strong>wp-config<\/strong> file stores a set of authentication keys and <a href=\"\/my\/tutorials\/wordpress-salts\">WordPress salts<\/a>, providing an extra layer of security for your website against brute force attacks. These random strings of data contain eight variables, all of which encrypt the login information kept by the cookies upon logging in to the WordPress website.<\/p><p>Considering their purpose, changing your authentication keys and salts periodically is one of many ways to <a href=\"\/my\/tutorials\/how-to-secure-wordpress\">improve WordPress security<\/a>. We recommend using a password generator or testing the ones you&rsquo;ve created with a password checker to ensure its durability against password-guessing attacks.<\/p><p>Alternatively, install a WordPress security plugin like <a href=\"https:\/\/wordpress.org\/plugins\/salt-shaker\/\" target=\"_blank\" rel=\"noopener\">Salt Shaker<\/a> to automatically generate the salt keys for you.<\/p><p>Once you have your passwords, paste them one by one inside the apostrophe to replace the value &ldquo;<strong>put your unique phrase here&rdquo;.<\/strong><\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**#@+\n* Authentication Unique Keys and Salts.\n*\n* Change these to different unique phrases!\n* You can generate these using the {@link https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/ WordPress.org secret-key service}\n*\n* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.\n*\n* @since 2.6.0\n*\/\ndefine( 'AUTH_KEY',         'put your unique phrase here' );\ndefine( 'SECURE_AUTH_KEY',  'put your unique phrase here' );\ndefine( 'LOGGED_IN_KEY',    'put your unique phrase here' );\ndefine( 'NONCE_KEY',        'put your unique phrase here' );\ndefine( 'AUTH_SALT',        'put your unique phrase here' );\ndefine( 'SECURE_AUTH_SALT', 'put your unique phrase here' );\ndefine( 'LOGGED_IN_SALT',   'put your unique phrase here' );\ndefine( 'NONCE_SALT',       'put your unique phrase here' );\n\n\/**#@-*\/<\/pre><p>After implementing the new security keys and WordPress salts, WordPress will log out all users and make current cookies invalid. Users will need to make another login attempt to access your site, consequently flushing out those with malicious intent.<\/p><h3 class=\"wp-block-heading\" id=\"h-database-table-prefix\">Database Table Prefix<\/h3><p>WordPress sets a predefined <strong>wp_<\/strong> database prefix in the <strong>wp-config<\/strong> file. Similar to your security keys, we recommend changing your database prefix at the earliest opportunity. Doing so will improve your database security against SQL injection attacks.<\/p><p>The following code snippet is the section within the <strong>wp-config<\/strong> file that stores your database prefix:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n* WordPress Database Table prefix.\n*\n* You can have multiple installations in one database if you give each\n* a unique prefix. Only numbers, letters, and underscores please!\n*\/\n$table_prefix  = 'wp_';<\/pre><p>As mentioned above, WordPress accepts a custom database prefix consisting of underscores, letters, and numbers. Make sure that it&rsquo;s unique enough that other users cannot guess it easily. For example:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$table_prefix  = 'wp_customprefix_';<\/pre><p>Verify whether you have successfully changed the table prefix by checking your <a href=\"\/my\/tutorials\/wordpress\/how-to-login-to-wordpress-dashboard\">WordPress database<\/a> via <strong>phpMyAdmin<\/strong>. If you access your database structure, the tables&rsquo; names should start with your assigned prefix. Here, we replace the default table prefix with <strong>wp_customprefix_<\/strong>.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/phpMyAdmin-database-structure.png\"><img decoding=\"async\" width=\"1024\" height=\"450\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/phpMyAdmin-database-structure-1024x450.png\" alt=\"Accessing database after changing the table prefix via phpMyAdmin.\" class=\"wp-image-37715\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/phpMyAdmin-database-structure-1024x450.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/phpMyAdmin-database-structure-300x132.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/phpMyAdmin-database-structure-150x66.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/phpMyAdmin-database-structure-768x338.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2021\/10\/phpMyAdmin-database-structure.png 1346w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-debugging-mode\">Debugging Mode<\/h3><p>If you&rsquo;re a WordPress developer, you&rsquo;ll find this <strong>wp-config<\/strong> setting useful for <a href=\"\/my\/tutorials\/debug-wordpress\">debugging WordPress sites<\/a>. The debug mode is responsible for notifying you whenever the WordPress site executes PHP code, allowing you to check if there&rsquo;s a bug in your code.<\/p><p>The following code snippet is the section within the WordPress <strong>wp-config<\/strong> file that stores your debug mode preference:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n* For developers: WordPress debugging mode.\n*\n* Change this to true to enable the display of notices during development.\n* It is strongly recommended that plugin and theme developers use WP_DEBUG\n* in their development environments.\n*\n* For information on other constants that can be used for debugging,\n* visit the documentation.\n*\n* @link https:\/\/wordpress.org\/support\/article\/debugging-in-wordpress\/\n*\/\ndefine( 'WP_DEBUG', false );<\/pre><p>WordPress turns off its debug mode by default. To turn this mode on, replace the <strong>false <\/strong>value with <strong>true<\/strong>.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_DEBUG', true );<\/pre><p>Keep in mind that enabling the debug mode will make your WordPress website display all PHP errors and warnings instead of showing a <a href=\"\/my\/tutorials\/fix-wordpress-white-screen-of-death\">white screen of death<\/a> for fatal errors only.<\/p><h3 class=\"wp-block-heading\" id=\"h-absolute-path\">Absolute Path<\/h3><p>The absolute path section states the location of a folder or a file within a computer. It determines the relationship between folders and files as well as the foundation of your site URL.<\/p><p>That said, you shouldn&rsquo;t change the information within the following code snippet:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/* That's all, stop editing! Happy publishing. *\/\n\/** Absolute path to the WordPress directory. *\/\nif ( ! defined( 'ABSPATH' ) ) {\n   define( 'ABSPATH', __DIR__ . '\/' );\n}\n\n\/** Sets up WordPress vars and included files. *\/\nrequire_once ABSPATH . 'wp-settings.php';<\/pre><h3 class=\"wp-block-heading\" id=\"h-wordpress-url\">WordPress URL<\/h3><p>Changing your WordPress URL is a necessary step if you want to move the site to another server or domain. It can be done via the <strong>Settings <\/strong>&rarr; <strong>General <\/strong>menu on your WordPress dashboard.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-settings-general-siteurl-highlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"490\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-settings-general-siteurl-highlighted-1024x490.png\" alt=\"WordPress General Settings. WordPress Address and Site Address fields highlighted\" class=\"wp-image-81387\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-siteurl-highlighted.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-siteurl-highlighted-300x144.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-siteurl-highlighted-150x72.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-siteurl-highlighted-768x368.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Sometimes, you may be unable to edit these WordPress address and site address values due to the <a href=\"\/my\/tutorials\/how-to-fix-err-too-many-redirects\">ERR_TOO_MANY_REDIRECTS error<\/a>. In that case, you can change your WordPress URL by adding the following code snippet to your <strong>wp-config.php<\/strong> file.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_HOME', 'http:\/\/example.com' );\ndefine( 'WP_SITEURL', 'http:\/\/example.com' );<\/pre><p>Make sure to replace the <strong>http:\/\/example.com<\/strong> value with your domain name and place the code above the line <strong>\/* That&rsquo;s all, stop editing! Happy publishing. *\/<\/strong>.<\/p><p>Include the <strong>www <\/strong>version of your website if you&rsquo;re using a <a href=\"\/my\/tutorials\/how-to-redirect-non-www-urls-to-www\">www URL<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-memory-size-limit\">Memory Size Limit<\/h3><p>WordPress requires PHP memory to execute scripts. The amount of memory you get depends on your web hosting. For instance, Hostinger allocates <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583711-what-is-php-memory-limit\" target=\"_blank\" rel=\"noopener\">512 MB of maximum memory limit<\/a> for <a href=\"\/my\/web-hosting\">basic web hosting plans.<\/a><\/p><p>If there&rsquo;s <a href=\"\/my\/tutorials\/wordpress-memory-limit\">not enough memory for WordPress<\/a> to use, it will display the <strong>memory exhausted<\/strong> error message. To solve this problem, set your own PHP memory limit value by adding the following code snippet to your <strong>wp-config<\/strong> file before the line <strong>\/* That&rsquo;s all, stop editing! Happy publishing. *\/<\/strong>.<\/p><p>In this example, we&rsquo;ll increase the memory allocation amount to 256 MB per PHP script.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define('WP_MEMORY_LIMIT', '256M');<\/pre><p>We recommend setting the PHP memory limit value based on your needs while enforcing the maximum memory limit per script. WordPress will enforce this memory limit only if the script requires more memory than the allocated one.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define('WP_MAX_MEMORY_LIMIT', '512M');<\/pre><p><div class=\"protip\">\n                    <h4 class=\"title\">Pro Tip<\/h4>\n                    <p>Don&rsquo;t go overboard with the memory limit value, as having excessive PHP memory increases the possibility of having rogue PHP scripts consuming the server&rsquo;s RAM.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-upload-directory\">Upload Directory<\/h3><p>WordPress redirects all your media uploads to the <strong>\/wp-content\/uploads\/<\/strong> directory. To improve your files&rsquo; security, you may redefine the upload path on your WordPress site.<\/p><p>Add the following code snippet below the <strong>WP_DEBUG <\/strong>code of your <strong>wp-config.php<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'UPLOADS', 'wp-content\/media' );<\/pre><p>This code will make WordPress store all media uploads in the new <strong>media <\/strong>directory within the <strong>wp-content<\/strong> folder. Feel free to change the new directory&rsquo;s name as desired.<\/p><p>If you want WordPress to store your media files in a directory outside <strong>wp-content<\/strong>, use the following code snippet to define the upload path.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'UPLOADS', ''.'media' );<\/pre><p>Keep in mind that both code snippets only work for defining a new uploads folder inside the root directory or the <strong>absolute path<\/strong> (ABSPATH).<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Pro Tip<\/h4>\n                    <p>Make sure to move the uploads folder content and change each upload file&rsquo;s URL in your WordPress database tables to avoid having broken links on your site.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-wp-content-directory\">wp-content Directory<\/h3><p>Besides media files, WordPress also stores your plugin and theme files in the <strong>wp-content<\/strong> folder. Since this folder path is a default WordPress setting, it&rsquo;s highly prone to malware injection attacks. Therefore, it&rsquo;s best to change the location of your <strong>wp-content <\/strong>folder.<\/p><p>Edit the <strong>wp-config.php<\/strong> file by adding custom code after the following line:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/* Add any custom values between this line and the \"stop editing\" line. *\/<\/pre><p>You need to define <strong>WP_CONTENT_DIR<\/strong> and change the location of your <strong>wp-content<\/strong> folder. Here&rsquo;s how you can do it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '\/blog\/content\/wp-content' );<\/pre><p>To change the location of the <strong>wp-content<\/strong> URL, there is another variable you need to define:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_CONTENT_URL', 'yourdomain.com\/blog\/content\/wp-content' );<\/pre><p>Don&rsquo;t forget to replace <strong>yourdomain.com<\/strong> with your own URL.<\/p><h3 class=\"wp-block-heading\" id=\"h-plugins-directory\">Plugins Directory<\/h3><p>If moving the WordPress content folder seems like a hassle, consider relocating the plugin folder instead. To do so, you need to define the WordPress constant variable <strong>wp_plugin_dir<\/strong> by adding the following code snippet below the <strong>wp-settings<\/strong> section:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;WP_PLUGIN_DIR&rsquo;, $_SERVER[&lsquo;DOCUMENT_ROOT&rsquo;] . &lsquo;\/blog\/content\/wp-content\/plugins&rsquo; );<\/pre><p>Make sure to change the plugin folder&rsquo;s URL within the variable <strong>wp_plugin_url<\/strong> by adding the following code:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;WP_PLUGIN_URL&rsquo;, &lsquo;yourdomain.com\/blog\/content\/wp-content\/plugins&rsquo;);<\/pre><p>Some plugin developers use the variable <strong>plugindir <\/strong>to run their programs. Don&rsquo;t forget to change it as well to avoid plugin conflicts within your WordPress site. Here&rsquo;s the code you need to add to the <strong>wp-config.php<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '\/blog\/content\/wp-content\/plugins' );<\/pre><h3 class=\"wp-block-heading\" id=\"h-theme-directory\">Theme Directory<\/h3><p>We don&rsquo;t recommend moving your themes folder as doing so may cause plugin conflicts. If you need an additional theme directory, create one by using the <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_theme_directory\/\" target=\"_blank\" rel=\"noopener\">register_theme_directory<\/a> function:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">function register_theme_directory( $directory ) {\n    global $wp_theme_directories;\n \n    if ( ! file_exists( $directory ) ) {\n        \/\/ Try prepending as the theme directory could be relative to the content directory.\n        $directory = WP_CONTENT_DIR . '\/' . $directory;\n        \/\/ If this directory does not exist, return and do not register.\n        if ( ! file_exists( $directory ) ) {\n            return false;\n        }\n    }\n \n    if ( ! is_array( $wp_theme_directories ) ) {\n        $wp_theme_directories = array();\n    }\n \n    $untrailed = untrailingslashit( $directory );\n    if ( ! empty( $untrailed ) &amp;&amp; ! in_array( $untrailed, $wp_theme_directories, true ) ) {\n        $wp_theme_directories[] = $untrailed;\n    }\n \n    return true;\n}<\/pre><p>Keep in mind that the new theme directory has to be within the root directory. This is because your server needs to have access to the website&rsquo;s theme files for them to work.<\/p><h3 class=\"wp-block-heading\" id=\"h-error-logging\">Error Logging<\/h3><p>Turning on the debug mode in WordPress only flags errors on the back-end and front-end of your site. To log the errors, you need to add its companion code below the line <strong>define(&lsquo;WP_DEBUG&rsquo;, true);<\/strong>.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;WP_DEBUG_LOG&rsquo;, true );<\/pre><p>If you want to save the errors in a file, use this code instead:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_DEBUG_LOG', '\/tmp\/wp-errors.log' );<\/pre><p>To turn off the error output, meaning that your browser won&rsquo;t display any information during the debugging process, use this code:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_DEBUG_DISPLAY', false );<\/pre><h3 class=\"wp-block-heading\" id=\"h-wordpress-auto-updates\">WordPress Auto Updates<\/h3><p>WordPress provides the option to enable the auto-update feature during the installation process, saving you the time from having to do it manually. However, it can backfire if you install a custom theme since there&rsquo;s no telling which update may affect your website&rsquo;s look.<\/p><p>To disable the auto-update feature, above the line <strong>\/* That&rsquo;s all, stop editing! Happy publishing. *\/ <\/strong>add the following code:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;AUTOMATIC_UPDATER_DISABLED&rsquo;, true );<\/pre><p>Replace the value <strong>true <\/strong>with <strong>false <\/strong>or delete this code if you want to re-enable auto-updates in the future.<\/p><h3 class=\"wp-block-heading\" id=\"h-wordpress-core-updates\">WordPress Core Updates<\/h3><p>WordPress version 3.7 and higher comes with <a href=\"\/my\/tutorials\/wordpress-auto-update\">automatic background updates<\/a> for minor core releases and translation files to ensure optimal performance. In some cases, the updates may include theme and plugin development files.<\/p><p>As this feature keeps your site up to date and secure, we recommend leaving it as default.<\/p><p>To blanket-enable development, minor, and major core updates, add the following code above the line <strong>\/* That&rsquo;s all, stop editing! Happy publishing. *\/<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_AUTO_UPDATE_CORE', true );<\/pre><p>Change the constant value to <strong>false<\/strong> to disable development, minor, and major core updates:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_AUTO_UPDATE_CORE', false);<\/pre><p>Alternatively, enable auto-updates for minor releases only by changing the constant value to <strong>minor<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_AUTO_UPDATE_CORE', &lsquo;minor&rsquo;);<\/pre><h3 class=\"wp-block-heading\" id=\"h-custom-user-table\">Custom User Table<\/h3><p>By default, WordPress provides you with a <strong>wp_users<\/strong> table to store user data. In case you need a custom user table post-installation, add the following code to your <strong>wp-config.php<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;CUSTOM_USER_TABLE&rsquo;, $table_prefix.&rsquo;my_users&rsquo; );<\/pre><p>Usually, developers use this code to share user tables between WordPress installations, which is useful for maintaining the same userbase across multiple websites.<\/p><h3 class=\"wp-block-heading\" id=\"h-custom-user-meta-table\">Custom User Meta Table<\/h3><p>If you decide to create a custom user table, you have to create another one to store your user metadata. The following code lets you create a custom user meta table:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;CUSTOM_USER_META_TABLE&rsquo;, $table_prefix.&rsquo;my_usermeta&rsquo; );<\/pre><p>A custom user meta table is useful for collecting and sharing user information across multiple WordPress installations. Membership plugins also use custom user meta tables to store membership information.<\/p><h3 class=\"wp-block-heading\" id=\"h-language-and-language-directory\">Language and Language Directory<\/h3><p>The default language for WordPress installation is U.S. English. WordPress version 4.0 and higher lets users change it on <strong>Settings <\/strong>&rarr; <strong>General <\/strong>in their admin dashboard. It&rsquo;s also possible to change the default language during the installation process.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-settings-general-language-highlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"417\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-settings-general-language-highlighted-1024x417.png\" alt=\"WordPress language settings.\" class=\"wp-image-81388\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-language-highlighted.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-language-highlighted-300x122.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-language-highlighted-150x61.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/wpadmin-settings-general-language-highlighted-768x313.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>If you want to switch to a different language, add the following code to the <strong>wp-config<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( &lsquo;WPLANG&rsquo;, &lsquo;de_DE&rsquo; );\ndefine( &lsquo;WP_LANG_DIR&rsquo;, dirname(__FILE__) . &lsquo;wordpress\/languages&rsquo; );<\/pre><p>The first line of code states which <strong>.mo<\/strong> language file to install, while the second one defines the language directory where the language file is stored.<\/p><p>The naming convention of the language files is based on the language code followed by the country code. For example, <strong>de_DE<\/strong> refers to the German language. Look up your desired language and country code on the <a href=\"https:\/\/www.gnu.org\/savannah-checkouts\/gnu\/gettext\/manual\/gettext.html\" target=\"_blank\" rel=\"noopener\">GNU gettext utilities page<\/a>.<\/p><p>If you enter the wrong combination of country and language code, WordPress will default to using U.S. English.<\/p><h3 class=\"wp-block-heading\" id=\"h-file-permissions\">File Permissions<\/h3><p>Configuring file permissions is another essential step to secure your website. The setting determines which users can view, modify, and execute core files and folders within your site.<\/p><p>Most hosting providers let you change file and folder permissions through the File Manager. Here&rsquo;s what the setting popup window looks like on Hostinger:<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-permissions.png\"><img decoding=\"async\" width=\"760\" height=\"940\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-permissions.png\" alt=\"The Permissions window on the File Manager\" class=\"wp-image-80355\" style=\"width:570px;height:705px\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-permissions.png 760w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-permissions-243x300.png 243w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/03\/filemanager-permissions-121x150.png 121w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/a><\/figure><\/div><p>Each permission level for the corresponding user is represented by a three-digit code consisting of:<\/p><ul class=\"wp-block-list\">\n<li><strong>0<\/strong> &#8210; no access<\/li>\n\n\n\n<li><strong>1<\/strong> &#8210; execute<\/li>\n\n\n\n<li><strong>2<\/strong> &#8210; write<\/li>\n\n\n\n<li><strong>4<\/strong> &#8210; read<\/li>\n\n\n\n<li><strong>3 (a combination of 2 and 1)<\/strong> &#8210; write and execute<\/li>\n\n\n\n<li><strong>5 (a combination of 4 and 1)<\/strong> &#8210; read and execute<\/li>\n\n\n\n<li><strong>6 (a combination of 4 and 2)<\/strong> &#8210; read and write<\/li>\n\n\n\n<li><strong>7 (a combination of 2 and 3)<\/strong> &#8210; read, write, and execute<\/li>\n<\/ul><p>If you cannot access the File Manager to change your file permissions, modify the <strong>wp-config<\/strong> file using a combination of the code above. Add the following code above the line <strong>\/* That&rsquo;s all, stop editing! Happy publishing. *\/<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'FS_CHMOD_DIR', ( 0755 &amp; ~ umask() ) );\ndefine( 'FS_CHMOD_FILE', ( 0644 &amp; ~ umask() ) );\nchmod 644 wp-config.php\nchmod 644 .htaccess<\/pre><p>The <strong>644 <\/strong>file permissions for <strong>wp-config<\/strong>, <strong>.htaccess<\/strong>, and other files make them visible to all users but are only modifiable by their owner. Meanwhile, the <strong>755 <\/strong>file permissions for WordPress directories and subdirectories mean that everyone can read and execute them, but only the owner can make changes.<\/p><p>    <p class=\"warning\">\n        <b>Warning!<\/b> Never set your file permissions to <b>777<\/b>, as it will give everyone access to read, write, and execute your files. On the other hand, <b>000<\/b> and <b>444<\/b> file permissions will break your website as they prevent WordPress from editing and executing theme and plugins files.    <\/p>\n    \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-editing-the-wp-config-php-file\">Editing the wp-config.php File<\/h2><p>If you want to edit the WordPress configuration file, it&rsquo;s best to back it up first. Keeping an extra copy of the information helps you fix any misconfigurations that may break your website.<\/p><p>The next step is to decide the tool you want to use. Developers usually use a text editor or an <a href=\"\/my\/tutorials\/best-html-editors\">HTML editor program<\/a>. This method requires downloading the WordPress configuration file and then re-uploading it to the same directory once you make the changes.<\/p><p>Alternatively, use the code editor that your web hosting&rsquo;s File Manager provides. Here&rsquo;s how to edit the <strong>wp-config.php<\/strong> file via Hostinger&rsquo;s File Manager.<\/p><ol class=\"wp-block-list\">\n<li>Navigate to <strong>File Manager<\/strong> from your hPanel.<\/li>\n\n\n\n<li>Click on the <strong>public_html<\/strong> folder in the sidebar.<\/li>\n\n\n\n<li>Double click the <strong>wp-config <\/strong>file and make the necessary changes.<\/li>\n\n\n\n<li>Once you&rsquo;re done, click <strong>Save<\/strong>.<\/li>\n<\/ol><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/my\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p><strong>Wp-config.php<\/strong> is a core WordPress file created during the website installation process. It establishes a connection between your WordPress website and its database as well as implements advanced settings on both.<\/p><p>You can find it within the root folder of your website using an FTP client or your hosting provider&rsquo;s File Manager.<\/p><p>The WordPress configuration file consists of several sections:<\/p><ul class=\"wp-block-list\">\n<li><strong>MySQL settings<\/strong> &#8210; WordPress database configuration.<\/li>\n\n\n\n<li><strong>Database character sets<\/strong> &#8210; used for defining tables with the appropriate charset settings.<\/li>\n\n\n\n<li><strong>Security keys<\/strong> &#8210; responsible for encrypting user information.<\/li>\n\n\n\n<li><strong>WordPress database table prefix<\/strong> &#8210; set the table prefix for better security.<\/li>\n\n\n\n<li><strong>Debugging mode<\/strong> &#8210; helpful in tracking PHP errors.<\/li>\n\n\n\n<li><strong>Absolute path<\/strong> &#8210; states the location of a folder or a file within a computer.<\/li>\n<\/ul><p>While WordPress <strong>wp-config.php<\/strong> is editable using a text editor, make sure to back up the file before making any changes. Even the smallest misconfiguration can disrupt the connection between the database and your WordPress website.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The wp-config.php file is a significant part of a WordPress installation. Created during the WordPress installation process, the file contains database configuration items. In short, it allows WordPress to establish a connection with the database. That said, a webmaster should know how to manage it properly to ensure the site&rsquo;s security. Without it, your WordPress [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/my\/tutorials\/wp-config-php\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":126883,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"wp-config.php: What Is It, Where to Find It and How to Edit It?","rank_math_description":"wp-config.php file helps establish a connection to the WordPress database. Learn how to optimize it to secure your WordPress site.","rank_math_focus_keyword":"wp-config.php","footnotes":""},"categories":[22632],"tags":[],"class_list":["post-14787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-use-wp-config-php-wordpress-function","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/arquivo-wp-config-php","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/wp-config-php","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/wp-config-php","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/wp-config-php","default":0},{"locale":"ja-JP","link":"https:\/\/www.hostinger.com\/jp\/tutorials\/wp-config-php\/","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-use-wp-config-php-wordpress-function","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-config-php","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-config-php","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/wp-config-php","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/wp-config-php","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/wp-config-php","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/arquivo-wp-config-php","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-use-wp-config-php-wordpress-function","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-use-wp-config-php-wordpress-function","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-use-wp-config-php-wordpress-function","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-use-wp-config-php-wordpress-function","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/14787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=14787"}],"version-history":[{"count":31,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/14787\/revisions"}],"predecessor-version":[{"id":126880,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/14787\/revisions\/126880"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media\/126883"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=14787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=14787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=14787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}