wp-content » themes » functions.php » Get All WordPress Constants

Get All WordPress Constants

PHP has a built-in function get_defined_constants that returns an array with the names of all the constants and their values. Because WordPress is built in PHP, We can use this function to get all WordPress constants.

⚠️ Use this snippet with caution, as the code will display sensitive information including your database username and password to ALL WordPress visitors:

print_r(get_defined_constants());

Here is How to Add Custom PHP Code to WordPress.

Output:

image 16 - Get All WordPress Constants
wp constants on wpxss.com

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended