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:

Was this post helpful?
Let me know if you liked the post. That’s the only way I can improve. 🙂