Pin It
Pages Menu
Categories Menu

Posted by on Dec 12, 2013 in Wordpress Tutorials | 0 comments

A Little Dig into WordPress define() (Not a Complete Guide)

A Little Dig into WordPress define() (Not a Complete Guide)

We all know that, WordPress is created in PHP programming language. It means, we can use custom PHP in WordPress. Here, we’ll share PHP’s define() function in terms of WordPress. Here, you’ll also see some constants, you never saw or used in WordPress. Let’s start from the constants, we already know. Then, we’ll go further.


1. define(‘DB_NAME’, ‘database_name’);

We usually use DB_NAME in wp-config.php file.

2. define(‘DB_USER’, ‘database_username’);

Enter your database use name.

3. define(‘DB_PASSWORD’, ‘database_password’);

Enter your database password here.

4. define(‘DB_HOST’, ‘localhost’);

DB_HOST may vary from host to host. Because different hosting providers provide different term.

5. define(‘WP_POST_REVISIONS’, false);

If you want to disable post revision, set WP_POST_REVISIONS to false, otherwise set it to true.

6. define( ‘AUTOSAVE_INTERVAL’, 120 );

We already know the autosave post or page capability of WordPress. You can also customize the autosave interval.

7. define( ‘UPLOADS’, ‘/your-directory/wp-content/uploads’ );

If you want to move your uploads folder anywhere else, you can use UPLOADS. Don’t put the absolute path. Just use like above.

8. define( ‘WP_PLUGIN_DIR’, dirname(__FILE__) . ‘/your-directory/wp-content/plugins’ );

This line helps to shift your plugins folder.

9. define( ‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/your-directory/wp-content’ );

Same thing, you can also move your wp-content folder.

Note: Here moving means just shifting one place to another. Not copy.

10. define( ‘WP_HOME’, ‘’ );

If you want to override wp_options_table for site URL, then you can do this in your wp-config.php.

Security Keys

I won’t recommend to mess with these. These keys are auto generated. So, code is something like below.

code = D&ovlU#|CvJ##uNq}bel+^MFtT&.b9{UvR]g%ixsXhGlRJ7q!h}XWdEC[BOKXssj.

11. define(‘AUTH_KEY’, ‘code’);

12. define(‘SECURE_AUTH_KEY’, ‘code’);

13. define(‘LOGGED_IN_KEY’, ‘code’);

14. define(‘NONCE_KEY’, ‘code’);

15. define(‘AUTH_SALT’, ‘code’);

16. define(‘SECURE_AUTH_SALT’, ‘code’);

17. define(‘LOGGED_IN_SALT’, ‘code’);

18. define(‘NONCE_SALT’, ‘code’);

Post a Reply

Your email address will not be published. Required fields are marked *