Located in the root of your ClassicPress file directory, wp-config.php is one of the most important files in your ClassicPress installation. This file contains the website’s base configuration details, such as database connection information.
When you first download ClassicPress installation files, the wp-config.php file isn’t included. However, a sample wp-config-sample.php is available to provide a guide should you need it. The ClassicPress guided setup process will create a wp-config.php file for you based on the information you provide in the installation process.
Editing the wp-config.php file should be done with caution, preferably with help from a technical person or by your host.
How to edit the wp-config.phpLink to this section
One needs access rights to the website files via the local/online hosting server in order to edit the wp-config.php file.
Some hosts offer a file manager with editor to begin any editing work. However, if your host does not allow direct edit access to the files, you can use SSH or an FTP/SFTP client like FileZilla or Cyberduck to download the file. Once you have the file on your computer, any code editing software can be used to make amendments, like Notepad++ or a more complex code editor like VS Code.
/** * The base configuration for ClassicPress * * The wp-config.php creation script uses this file during the installation. * You don't have to use the web site, you can copy this file to "wp-config.php" * and fill in the values. * * This file contains the following configurations: * * * Database settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://docs.classicpress.net/user-guides/editing-wp-config-php/ * * @package ClassicPress */ // ** Database settings - You can get this info from your web host ** // /** The name of the database for ClassicPress */ define( 'DB_NAME', 'database_name_here' ); /** Database username */ define( 'DB_USER', 'username_here' ); /** Database password */ define( 'DB_PASSWORD', 'password_here' ); /** Database hostname */ define( 'DB_HOST', 'localhost' ); /** Database charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8mb4' ); /** The database collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' );
Adding constants to wp-config.phpLink to this section
In the sections below you will find commonly used constants to modify the behavior of certain parts of ClassicPress. All of them can be added to your wp-config.php file. Generally you should insert these constants before /* That's all, stop editing! Happy publishing. */.
DebuggingLink to this section
Debugging PHP code is part of any project, but ClassicPress comes with specific debugging systems designed to simplify the process as well as standardize code across the core, plugins, and themes. Detailed descriptions of the various debugging constants is available at the Debugging in ClassicPress page.
Post RevisionsLink to this section
ClassicPress, by default, will save copies of each edit made to a post or page, allowing the possibility of reverting to a previous version of that post or page. The saving of revisions can be disabled, or a maximum number of revisions per post or page can be specified.
Disable Post Revisions
If you do not set this value, ClassicPress defaults the WP_POST_REVISIONS constant to true (enable post revisions). If you want to disable the revisions feature, use this setting:
define( 'WP_POST_REVISIONS', false );
Specify the Number of Post Revisions
If you want to specify a maximum number of revisions that ClassicPress stores, change false to an integer/number (e.g. 3 or 10).
define( 'WP_POST_REVISIONS', 3 );
Empty TrashLink to this section
This constant controls the number of days before ClassicPress permanently deletes posts, pages and comments from the trash bin. The default is 30 days:
define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days
To disable trash set the number of days to zero.
define( 'EMPTY_TRASH_DAYS', 0 ); // Zero days
For posts, pages and comments the “(Move to) Trash” link is replaced by a “Delete Permanently” link. ClassicPress will not ask for confirmation when someone clicks on “Delete Permanently”.
Enable or Disable Plugin and Theme File EditorLink to this section
The File Editor for plugins and themes is disabled in new installations. This provides an additional layer of security if a hacker gains access to a well-privileged user account. It also prevents overzealous users from being able to edit sensitive files and potentially crash the site.
If you want to enable the File Editor, you should change the value to false.
define( 'DISALLOW_FILE_EDIT', false );
Modify ClassicPress Core UpdatesLink to this section
You may have heard of using the WP_AUTO_UPDATE_CORE constant in your wp-config file. A constant used by WordPress to modify the behavior of automatic updates. This constant does not work the same in ClassicPress, because we don’t allow automatic updates between major versions (e.g. 1.1 to 2.0). Besides this, it depends on your host whether or not automatic updates are enabled.
Understanding CONCATENATE_SCRIPTSLink to this section
This setting is built into the ClassicPress core and is intended to optimise the loading of scripts and styling in the admin area of your sites; the setting defaults to true. In this configuration, JavaScript and CSS files are minified and grouped together to reduce load on the server. The advantage derives from a reduced number of HTTP requests on loading the site.
However on more modern HTTP protocols, the advantage is greatly reduced and can actually have a negative impact and slow down site loading times. HTTP/2 and HTTP/3 protocols allow for multiplexing, allowing multiple requests and responses to be sent simultaneously over a single connection. Browser can then leverage better local caching of individual files.
From ClassicPress 2.8.0, the Site Health tests include a check for your site Protocol and will indicate if your site may well benefit from disabling script concatenation. To test if this is the case, add the following line to your wp-config.php file:
define( 'CONCATENATE_SCRIPTS', false );
Additional ConstantsLink to this section
This page describes commonly used constants, but in this WordPress article you will find additional constants.