WordPress Constants

In the course of working on WordPress, and plugins and such for WordPress, I frequently find myself at a loss to remember the name of constants provided by the system. Hey, isn’t there a constant for such-and-such directory?

I did a bit of grepping and parsing just now, and in the hopes that it might be of use to my fellow WordPress hackers, here is my list of every defined CONSTANT in the latest WordPress 2.7-bleeding setup.

ABSPATH
ADMIN_COOKIE_PATH
APP_REQUEST
ARRAY_A
ARRAY_N
ATOM
AUTH_COOKIE
AUTH_KEY
AUTOSAVE_INTERVAL
COMMENTS_TEMPLATE
COOKIEHASH
COOKIEPATH
COOKIE_DOMAIN
CRLF
CUSTOM_TAGS
DB_CHARSET
DB_COLLATE
DB_HOST
DB_NAME
DB_PASSW
DB_PASSWORD
DB_USER
DOING_AJAX
DOING_AUTOSAVE
DOING_CRON
EP_ALL
EP_ATTACHMENT
EP_AUTHORS
EP_CATEGORIES
EP_COMMENTS
EP_DATE
EP_DAY
EP_MONTH
EP_NONE
EP_PAGES
EP_PERMALINK
EP_ROOT
EP_SEARCH
EP_TAGS
EP_YEAR
EZSQL_VERSION
FORCE_SSL_ADMIN
FORCE_SSL_LOGIN
FTP_ASCII
FTP_AUTOASCII
FTP_BINARY
FTP_FORCE
FTP_OS_Mac
FTP_OS_Unix
FTP_OS_Windows
IS_PROFILE_PAGE
JSON_BOOL
JSON_END_ARRAY
JSON_END_OBJ
JSON_FLOAT
JSON_INT
JSON_IN_ARRAY
JSON_IN_BETWEEN
JSON_IN_OBJECT
JSON_KEY
JSON_NULL
JSON_SKIP
JSON_START_ARRAY
JSON_START_OBJ
JSON_STR
LANGDIR
LOGGED_IN_COOKIE
LOGGED_IN_KEY
MAGPIE_CACHE_AGE
MAGPIE_CACHE_DIR
MAGPIE_CACHE_FRESH_ONLY
MAGPIE_CACHE_ON
MAGPIE_DEBUG
MAGPIE_FETCH_TIME_OUT
MAGPIE_INITALIZED
MAGPIE_USER_AGENT
MAGPIE_USE_GZIP
MAX_EXECUTION_TIME
MAX_RESULTS
MC_LOGGER_DEBUG
MC_LOGGER_ERROR
MC_LOGGER_FATAL
MC_LOGGER_INFO
MC_LOGGER_WARN
OBJECT
OBJECT_K
PASS_COOKIE
PCLZIP_ATT_FILE_NAME
PCLZIP_ATT_FILE_NEW_FULL_NAME
PCLZIP_ATT_FILE_NEW_SHORT_NAME
PCLZIP_CB_POST_ADD
PCLZIP_CB_POST_DELETE
PCLZIP_CB_POST_EXTRACT
PCLZIP_CB_POST_LIST
PCLZIP_CB_PRE_ADD
PCLZIP_CB_PRE_DELETE
PCLZIP_CB_PRE_EXTRACT
PCLZIP_CB_PRE_LIST
PCLZIP_ERROR_EXTERNAL
PCLZIP_ERR_ALREADY_A_DIRECTORY
PCLZIP_ERR_BAD_CHECKSUM
PCLZIP_ERR_BAD_EXTENSION
PCLZIP_ERR_BAD_EXTRACTED_FILE
PCLZIP_ERR_BAD_FORMAT
PCLZIP_ERR_DELETE_FILE_FAIL
PCLZIP_ERR_DIRECTORY_RESTRICTION
PCLZIP_ERR_DIR_CREATE_FAIL
PCLZIP_ERR_FILENAME_TOO_LONG
PCLZIP_ERR_INVALID_ARCHIVE_ZIP
PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
PCLZIP_ERR_INVALID_OPTION_VALUE
PCLZIP_ERR_INVALID_PARAMETER
PCLZIP_ERR_INVALID_ZIP
PCLZIP_ERR_MISSING_FILE
PCLZIP_ERR_MISSING_OPTION_VALUE
PCLZIP_ERR_NO_ERROR
PCLZIP_ERR_READ_OPEN_FAIL
PCLZIP_ERR_RENAME_FILE_FAIL
PCLZIP_ERR_UNSUPPORTED_COMPRESSION
PCLZIP_ERR_UNSUPPORTED_ENCRYPTION
PCLZIP_ERR_USER_ABORTED
PCLZIP_ERR_WRITE_OPEN_FAIL
PCLZIP_OPT_ADD_COMMENT
PCLZIP_OPT_ADD_PATH
PCLZIP_OPT_BY_EREG
PCLZIP_OPT_BY_INDEX
PCLZIP_OPT_BY_NAME
PCLZIP_OPT_BY_PREG
PCLZIP_OPT_COMMENT
PCLZIP_OPT_CRYPT
PCLZIP_OPT_EXTRACT_AS_STRING
PCLZIP_OPT_EXTRACT_DIR_RESTRICTION
PCLZIP_OPT_EXTRACT_IN_OUTPUT
PCLZIP_OPT_NO_COMPRESSION
PCLZIP_OPT_PATH
PCLZIP_OPT_PREPEND_COMMENT
PCLZIP_OPT_REMOVE_ALL_PATH
PCLZIP_OPT_REMOVE_PATH
PCLZIP_OPT_REPLACE_NEWER
PCLZIP_OPT_SET_CHMOD
PCLZIP_OPT_STOP_ON_ERROR
PCLZIP_READ_BLOCK_SIZE
PCLZIP_SEPARATOR
PCLZIP_TEMPORARY_DIR
PLUGINDIR
PLUGINS_COOKIE_PATH
RSS
SECRET_KEY
SECURE_AUTH_COOKIE
SECURE_AUTH_KEY
SITECOOKIEPATH
STATUS_INTERVAL
STYLESHEETPATH
TEMPLATEPATH
TEST_COOKIE
USER_COOKIE
WPINC
WP_ADMIN
WP_CONTENT_DIR
WP_CONTENT_URL
WP_DEBUG
WP_IMPORTING
WP_INSTALLING
WP_LANG_DIR
WP_MEMORY_LIMIT
WP_PLUGIN_DIR
WP_PLUGIN_URL
WP_UNINSTALL_PLUGIN
WP_USE_THEMES
WXR_VERSION
This entry was posted in Codecraft, On the Front Lines and tagged , , . Bookmark the permalink.

8 Responses to WordPress Constants

  1. Ozh says:

    [Note: Comment originally posted to previous post. Moved here for obvious reasons… — ed.]

    Hey, this is actually a comment for the next post about constant, but… you forgot to define a fun quizz for this post so nobody can comment because there’s no question to answer and yet the plugin won’t let any comment make it through :) Idea for improvement here?

    Anyway, my comment was: what would help even more fellow hackers would be to mention which constants were designed to be user defined in wp-config.php (ie constants enclosed in a “if !defined then define”)

  2. Stephen says:

    Wow. That there would constitute a significant bug in my quiz plugin. That’s why it’s a beta — to discover these issues before final release. Thanks for letting me know. ;)

    Anyway, my comment was: what would help even more fellow hackers would be to mention which constants were designed to be user defined in wp-config.php

    True. I didn’t go full boat with this, but there are definitely times when I’m trying to remember if such and such constant exists, or what the name is. This list will help jog my memory — at least let me know what to look for. :)

  3. Momekh says:

    Although most of the posts here are not in English (as far as I am concerned), I am trying for the past few days to write perhaps the world’s simplest plugin i.e. setting one’s favicon. Along with the process, I am learning PHP and the WP system itself, so I have a long way to go to parse much of what you talk about here.

    But your website looks like a great hub of info for me. Thanks for putting such stuff up. From Pakistan, peace out. :)

    God bless and good luck,
    M.

    • Stephen R says:

      Momehk — Welcome to WordPress hacking! ;-)

      Here’s my two-second “How to write plugins” class: learn about add_action and add_filter

      In your case (just off the top of my head) I think you want to do something like this:

      add_action( 'wp-head', 'add_custom_favicon');
      
      function add_custom_favicon() {
          // echo the favicon HTML line here
      }
      
  4. Momekh says:

    way ahead of you broda :) Thanks.

    But Right now I just can not find any docs on register_settings to write plugins. Guess a good plugin author would use that activation function still, right?
    And More importantly, I can set and reset the favicon etc. That bit is done. Now I want to have the option of uploading an image. The validation of the image is for later (that its a png or an ico file, is a certain size etc). But I have no clue as to HOW to upload images and store them through a plugin’s options page.

    Any hints on that? Thanks either way.

    P.S. I have also made bare-bones plugin that replaces the site title from text to an image (stole the code from kubrick, which injects css into the main page :) ), so yea, its a steep learning curve here :)

  5. Momekh says:

    thanks man, appreciated. :)

  6. abhay says:

    Nice collection. The same I got from Here

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>