WordPress Bits

Hacking WordPress. Keeping the bits together.

Tip #7 : WordPress constants

Posted by Leonid Mamchenkov on October 5, 2007

ABSPATH is one of the most known WordPress constants. It holds filesystem path to WordPress installation and is often used to construct filesystem paths relative to WordPress. But what other constants are there in WordPress? The answer is easy to get than it might seem. You can see a full list here.

(Thanks to Benedict Eastaugh over at wp-hackers mailing list for the above link)


12 Responses to “Tip #7 : WordPress constants”

  1. Samuel said

    The link is broken :(

  2. Samuel said

    Here’s the correct link. It seems that dont like direct access to the generated url (after click on this).

  3. Samuel,

    thanks for letting me know. I’ve fixed the link in the post. It was a copy-pasto. :)

  4. Thanks for the tip

  5. davidrpotter said

    Good reference. It would be nice to see some info on what the constants are used for (e.g. definition, purpose), but this is a good start.

  6. davidrpotter,

    constants hold a value which cannot be changed during the execution of the script. Sometimes these values come handy. When writing plugins for example. Like with ABSPATH example above. Instead of trying to figure out in which directory WordPress is installed, just use the value in ABSPATH.

  7. […] Bits is such a blog. A recent article, Tip #7 : WordPress constants, showed up on my WordPress dashboard and I just had to take a look. While the article points to a […]

  8. Thanks – i’ve never experimented with changing constants yet. /me enjoys post.

  9. Thanks for the tip, some constants are a popular target for malicious hacker bots/scripts!

  10. blackmoon said

    thanks for your tips

  11. Michel said

    Sometimes ABSPATH is your enemy, for example, when you want to go ONE DIRECTORY UP from WordPress;-)

    I had this problem with file uploads, because my upload dir is one level up from my WordPress install dirs… Still didn’t resolve it :(

  12. […] WordPress Constants […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: