Articles of constants

How to use defined in class file with namespace

Here is my code. defined( ‘ABSPATH’ ) || exit; namespace JSR; class myClass{ … } This is giving below error Global code should be enclosed in global namespace declaration Any idea how to fix it?

Are there any security issues with setting the WP_INSTALLING constant to true?

Running WordPress 4.1 on a CentOS 6.5 instance through VirtualBox as a dev server. When logged in as admin on both ssl and non-ssl sites WordPress curl requests are taking a long time to run (45+ seconds overall before page loads). This renders my dev site unusable, as you can imagine. While browsing around I […]

Use theme constants in plugin?

I’m creating a plugin version of the Roots Theme function additions – to make it a bit more portable, but have run into a snag. Part of what Roots does is add htaccess rules based on the current theme information — like so: // only use clean urls if the theme isn’t a child or […]

Turn Off Automatic Trash Deletion?

I have a client who wants to use the trash feature, but keep items in there indefinitely (I have no idea why, but they insist on it). From reading this codex article on the trash status, I see that you can set the EMPTY_TRASH_DAYS constant to zero. But it says that this will disable trash […]

BLOG_ID_CURRENT_SITE vs. SITE_ID_CURRENT_SITE in WordPress Multisite?

I’ve been trying to figure out why we have the constants BLOG_ID_CURRENT_SITE and SITE_ID_CURRENT_SITE (vs. hardcoding them to be equal to 1), what exactly the differences are, and when either of them will not equal 1? Any insight will be appreciated. Thanks in advance.

What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?

The WordPress documentation for Determining Plugin and Content Directories states that: WordPress makes use of the following constants when determining the path to the content and plugin directories. These should not be used directly by plugins or themes, but are listed here for completeness. It goes on to list WP_CONTENT_DIR and WP_PLUGIN_DIR among constants that […]