WordPress constants overview

In the backend of WordPress you don’t have an input field for each possible modification. Some are only available via an action or a filter and for some changes you need to define or change a PHP constant.
In this article I have listed all constants which WordPress has by nature (except the deprecated ones).

A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script. A constant is case-sensitive by default. By convention, constant identifiers are always uppercase.
PHP docs

Content

General

  • AUTOSAVE_INTERVAL #
    Defines an interval, in which WordPress should do an autosave.
    Value: time in seconds (Default: 60)
  • CORE_UPGRADE_SKIP_NEW_BUNDLED #
    Allows you to skip new bundles files like plugins and/or themes on upgrades.
    Values: true|false
  • DISABLE_WP_CRON #
    Deactivates the cron function of WordPress.
    Value: true
  • EMPTY_TRASH_DAYS #
    Controls the number of days before WordPress permanently deletes posts, pages, attachments, and comments, from the trash bin.
    Value: time in days (Default: 30)
  • IMAGE_EDIT_OVERWRITE #
    Allows WordPress to override an image after editing or to save the image as a copy.
    Values: true|false
  • MEDIA_TRASH #
    (De)activates the trash bin function for media.
    Values: true|false (Default: false)
  • WPLANG #
    Defines the language which WordPress should use.
    Values: For German de_DE
  • WP_DEFAULT_THEME #
    Defines a default theme for new sites, also used as fallback for a broken theme.
    Value: template name (Default: twentyeleven)
  • WP_CRON_LOCK_TIMEOUT #
    Defines a period of time in which only one cronjob will be fired. Since WordPress 3.3.
    Value: time in seconds (Default: 60)
  • WP_MAIL_INTERVAL #
    Defines a period of time in which only one mail request can be done.
    Value: time in seconds (Default: 300)
  • WP_POST_REVISIONS #
    (De)activates the revision function for posts. A number greater than 0 defines the number of revisions for one post.
    Values: true|false|number (Default: true)
  • WP_MAX_MEMORY_LIMIT #
    Allows you to change the maximum memory limit for some WordPress functions.
    Values: See PHP docs (Default: 256M)
  • WP_MEMORY_LIMIT #
    Defines the memory limit for WordPress.
    Values: See PHP docs (Default: 32M, for Multisite 64M)

Status

  • APP_REQUEST #
    Will be defined if it’s an Atom Publishing Protocol request.
    Value: true
  • COMMENTS_TEMPLATE #
    Will be defined if the comments template is loaded.
    Value: true
  • DOING_AJAX #
    Will be defined if it’s an AJAX request.
    Value: true
  • DOING_AUTOSAVE #
    Will be defined if WordPress is doing an autosave for posts.
    Value: true
  • DOING_CRON #
    Will be defined if WordPress is doing a cronjob.
    Value: true
  • IFRAME_REQUEST #
    Will be defined if it’s an inlineframe request.
    Value: true
  • IS_PROFILE_PAGE #
    Will be defined if a user change his profile settings.
    Value: true
  • SHORTINIT #
    Can be defined to load only the half of WordPress.
    Value: true
  • WP_ADMIN #
    Will be defined if it’s a request in backend of WordPress.
    Value: true
  • WP_BLOG_ADMIN #
    Will be defined if it’s a request in /wp-admin/.
    Value: true
  • WP_IMPORTING #
    Will be defined if WordPress is importing data.
    Value: true
  • WP_INSTALLING #
    Will be defined on an new installation or on an upgrade.
    Value: true
  • #WP_INSTALLING_NETWORK #
    Will be defined if it’s a request in network admin or on installing a network. Since WordPress 3.3, previous WP_NETWORK_ADMIN_PAGE.
    Value: true
  • WP_LOAD_IMPORTERS #
    Will be defined if you visit the importer overview (Tools → Importer).
    Value: true
  • WP_NETWORK_ADMIN #
    Will be defined if it’s a request in /wp-admin/network/.
    Value: true
  • WP_REPAIRING #
    Will be defined if it’s a request to /wp-admin/maint/repair.php.
    Value: true
  • WP_SETUP_CONFIG #
    Will be defined if WordPress will be installed or configured.
    Value: true
  • WP_UNINSTALL_PLUGIN #
    Will be defined if a plugin wil be uninstalled (for uninstall.php).
    Value: true
  • WP_USER_ADMIN #
    Will be defined if it’s a request in /wp-admin/user/.
    Value: true
  • XMLRPC_REQUEST #
    Will be defined if it’s a request over the XML-RPC API.
    Value: true

Paths, dirs and links

  • ABSPATH #
    Absolute path to the WordPress root dir.
    Default: path to wp-load.php
  • WPINC #
    Relative path to the /wp-includes/. You can’t change it.
    Default: wp-includes
  • WP_LANG_DIR #
    Absolute path to the folder with language files.
    Default: WP_CONTENT_DIR /languages or WP_CONTENT_DIR WPINC /languages
  • WP_PLUGIN_DIR #
    Absolute path to the plugins dir.
    Default: WP_CONTENT_DIR /plugins
  • WP_PLUGIN_URL #
    URL to the plugins dir.
    Default: WP_CONTENT_URL /plugins
  • WP_CONTENT_DIR #
    Absolute path to thewp-content dir.
    Default: ABSPATH wp-content
  • WP_CONTENT_URL #
    URL to the wp-content dir.
    Default: {Site URL}/wp-content
  • WP_HOME #
    Home URL of your WordPress.
  • WP_SITEURL #
    URL to the WordPress root dir.
  • WP_TEMP_DIR #
    Absolute path to a dir, where temporary files can be saved.
  • WPMU_PLUGIN_DIR #
    Absolute path to the must use plugin dir.
    Default: WP_CONTENT_DIR /mu-plugins
  • WPMU_PLUGIN_URL #
    URL to the must use plugin dir.
    Default: WP_CONTENT_URL /mu-plugins

Database

  • DB_CHARSET #
    Defines the database charset.
    Values: See MySQL docs (Default: utf8)
  • DB_COLLATE #
    Defines the database collation.
    Values: See MySQL docs (Default: utf8_general_ci)
  • DB_HOST #
    Defines the database host.
    Values: IP address, domain and/or port (Default: localhost)
  • DB_NAME #
    Defines the database name.
    Value: database name
  • DB_PASSWORD #
    Defines the database password.
  • DB_USER #
    Defines the database user.
  • WP_ALLOW_REPAIR #
    Allows you to automatically repair and optimize the database tables via /wp-admin/maint/repair.php.
    Value: true
  • CUSTOM_USER_TABLE #
    Allows you to define a custom user table.
    Value: table name
  • CUSTOM_USER_META_TABLE #
    Allows you to define a custom user meta table.
    Value: table name

Multisite

  • ALLOW_SUBDIRECTORY_INSTALL #
    Allows you to install Multisite in a subdirectory.
    Value: true
  • BLOGUPLOADDIR #
    Absolute path to the site specific upload dir.
    Default: WP_CONTENT_DIR /blogs.dir/{Blog ID}/files/
  • BLOG_ID_CURRENT_SITE #
    Blog ID of the main site.
    Default: 1
  • DOMAIN_CURRENT_SITE #
    Domain of the main site.
    Default: domain
  • DIEONDBERROR #
    When defined database errors will be displayed on screen.
    Value: true
  • ERRORLOGFILE #
    When defined database erros will be logged into a file.
    Value: absolute path to a writeable file
  • MULTISITE #
    Will be defined if Multisite is used.
    Value: true
  • NOBLOGREDIRECT #
    Defines an URL of a site on which WordPress should redirect, if registration is closed or a site doesn’t exists.
    Values: %siteurl% for mainsite or custom URL
  • PATH_CURRENT_SITE #
    Path to the main site.
  • UPLOADBLOGSDIR #
    Path to the upload base dir, relative to ABSPATH.
    Default: wp-content/blogs.dir
  • SITE_ID_CURRENT_SITE #
    Network ID of the main site.
    Default: 1
  • SUBDOMAIN_INSTALL #
    Defines if it’s a subdomain install or not.
    Values: true|false
  • SUNRISE #
    When defined WordPres will load the /wp-content/sunrise.php file.
    Value: true
  • UPLOADS #
    Path to site specific upload dir, relative to ABSPATH.
    Default: UPLOADBLOGSDIR /{blogid}/files/
  • WPMU_ACCEL_REDIRECT #
    (De)activates support for X-Sendfile Header.
    Values: true|false (Default: false)
  • WPMU_SENDFILE #
    (De)activates support for X-Accel-Redirect Header.
    Values: true|false (Default: false)
  • WP_ALLOW_MULTISITE #
    When defined the multisite function will be accessible (Tools → Network Setup).
    Value: true

Cache and script compressing

  • WP_CACHE #
    When defined WordPres will load the /wp-content/advanced-cache.php file.
    Values: true|false (Default: false)
  • COMPRESS_CSS #
    (De)activates the compressing of stylesheets.
    Values: true|false
  • COMPRESS_SCRIPTS #
    (De)activates the compressing of Javascript files.
    Values: true|false
  • CONCATENATE_SCRIPTS #
    (De)activates the consolidation of Javascript or CSS files before compressing.
    Values: true|false
  • ENFORCE_GZIP #
    (De)activates gzip output.
    Values: true|false

Filesystem and connections

  • FS_CHMOD_DIR #
    Defines the read and write permissions for directories.
    Values: See PHP handbook (Default: 0755)
  • FS_CHMOD_FILE #
    Defines the read and write permissions for files.
    Values: See PHP handbook (Default: 0644)
  • FS_CONNECT_TIMEOUT #
    Defines a timeout for building a connection.
    Values: time in seconds (Default: 30)
  • FS_METHOD #
    Defines the method to connect to the filesystem.
    Values: direct|ssh|ftpext|ftpsockets
  • FS_TIMEOUT #
    Defines a timeout after a connection has been lost.
    Values: time in seconds (Default: 30)
  • FTP_BASE #
    Path to the WordPress root dir.
    Default: ABSPATH
  • FTP_CONTENT_DIR #
    Path to the /wp-content/ dir.
    Default: WP_CONTENT_DIR
  • FTP_HOST #
    Defines the FTP host.
    Values: IP Adresse, Domain und/oder Port
  • FTP_LANG_DIR #
    Path to the folder with language files.
    Default: WP_LANG_DIR
  • FTP_PASS #
    Defines the FTP password.
  • FTP_PLUGIN_DIR #
    Path to the plugin dir.
    Default: WP_PLUGIN_DIR
  • FTP_PRIKEY #
    Defines a private key for SSH.
  • FTP_PUBKEY #
    Defines a public key for SSH.
  • FTP_SSH #
    (De)activates SSH.
    Values: true|false
  • FTP_SSL #
    (De)activates SSL.
    Values: true|false
  • FTP_USER #
    Defines the FTP username.
  • WP_PROXY_BYPASS_HOSTS #
    Allows you to define some adresses which shouldn’t be passed through a proxy.
    Values: www.example.com, *.example.org
  • WP_PROXY_HOST #
    Defines the proxy adresse.
    Values: IP address or domain
  • WP_PROXY_PASSWORD #
    Defines the proxy password.
  • WP_PROXY_PORT #
    Defines the proxy port.
  • WP_PROXY_USERNAME #
    Defines the proxy username.
  • WP_HTTP_BLOCK_EXTERNAL #
    Allows you to block external request.
    Values: true|false
  • WP_ACCESSIBLE_HOSTS #
    If WP_HTTP_BLOCK_EXTERNAL is defined you can add hosts which shouldn’t be blocked.
    Values: www.example.com, *.example.org

Themes

  • BACKGROUND_IMAGE #
    Defines a default background image.
  • HEADER_IMAGE #
    Defines a default header image.
  • HEADER_IMAGE_HEIGHT #
    Defines the height of the header image.
  • HEADER_IMAGE_WIDTH #
    Defines the width of the header image.
  • HEADER_TEXTCOLOR #
    Defines the font color for the header text.
  • NO_HEADER_TEXT #
    (De)activates the support for header text.
    Values: true|false
  • STYLESHEETPATH #
    Defines the absolute path to the stylesheet of the current theme.
  • TEMPLATEPATH #
    Defines the absolute path to the template files of the current theme.
  • WP_USE_THEMES #
    (De)activates the loading of themes.
    Values: true|false

Debug

  • SAVEQUERIES #
    (De)activates the saving of database queries in an array ($wpdb->queries).
    Values: true|false
  • SCRIPT_DEBUG #
    (De)activates the loading of compressed Javascript and CSS files.
    Values: true|false
  • WP_DEBUG #
    (De)activates the debug mode in WordPress.
    Values: true|false (Default: false)
  • WP_DEBUG_DISPLAY #
    (De)activates the display of errors on the screen.
    Values: true|false|null (Default: true)
  • WP_DEBUG_LOG #
    (De)activates the writing of errors to the /wp-content/debug.log file.
    Values: true|false (Default: false)

Security and cookies

  • ALLOW_UNFILTERED_UPLOADS #
    Allows unfiltered uploads by admins.
    Value: true
  • AUTH_KEY #
    Secret key.
    Values: See generator
  • AUTH_SALT #
    Secret key.
    Values: See generator
  • COOKIEHASH #
    Hash for generating cookie names.
  • COOKIEPATH #
    Path to WordPress root dir.
    Default: Home URL without http(s)://
  • CUSTOM_TAGS #
    Allows you to override the list of secure HTML tags. See /wp-includes/kses.php.
    Values: true|false (Default: false)
  • DISALLOW_FILE_EDIT #
    Allows you to disallow theme and plugin edits via WordPress editor.
    Value: true
  • DISALLOW_FILE_MODS #
    Allows you to disallow the editing, updating, installing and deleting of plugins, themes and core files via WordPress Backend.
    Value: true
  • DISALLOW_UNFILTERED_HTML #
    Allows you to disallow unfiltered HTML for every user, admins too.
    Value: true
  • FORCE_SSL_ADMIN #
    Activates SSL for logins and in the backend.
    Values: true|false (Default: false)
  • FORCE_SSL_LOGIN #
    Activates SSL for logins.
    Values: true|false (Default: false)
  • LOGGED_IN_KEY #
    Secret key.
    Values: See generator
  • LOGGED_IN_SALT #
    Secret key.
    Values: See generator
  • NONCE_KEY #
    Secret key.
    Values: See generator
  • NONCE_SALT #
    Secret key.
    Values: See generator
  • SECURE_AUTH_KEY #
    Secret key.
    Values: See generator
  • SECURE_AUTH_SALT #
    Secret key.
    Values: See generator
  • SITECOOKIEPATH #
    Path of you site.
    Default: Site URL without http(s)://

Guest Post

Dominik Schilling AvatarThis post is written by Dominik Schilling – wpgrafie.de and is a post in our Advent Calendar on WP Engineer about WordPress. Dominik is Student, Web Developer, WordPress Contributing Developer – ocean90 and he ♥ WordPress.
Thank you very much from my part to Dominik.
If you also like to have your interesting post published on our website, please let us know on our contact page. Of course we will appreciate your contribution!


Posted

in

by

Tags:

Comments

9 responses to “WordPress constants overview”

  1. Neolot Avatar

    Thanks Dominic, very useful

  2. Robert Avatar

    great summary, thanks! really saves me a lot of time!

  3. […] sich um 2 sehr interessante Sammlungen für WordPress Entwickler. Als erstes möchte ich hier die WordPress constants overview erwähnen. In der Sammlung findet man alle möglichen WordPress Konstanten. Die Liste ist sehr […]

  4. Trace Avatar

    Awesome stuff, thanks for taking the time to put this together!

  5. maurice Avatar

    That’s a great overview, thank you very much!

  6. Xstroy Avatar

    Thanks Dominic!
    Sometimes you need to do something in WP, but little information…

  7. Steffy Avatar
    Steffy

    Awesome list!!! a time save

    there is a typo on language at

    WP_LANG_DIR #
    Absolute path to the folder with lanugage files

  8. Frank Avatar

    @Steffy: thanks, i have fixed this typo.

  9. […] List Of All Available WordPress Constants There are a boatload of constants available to use in WordPress, and the guys over at WPEngineer put together a nice article that lists all of them, with a short description of each. […]