WordPress uses PHP as the core language. So die() would be just fine to use. In fact, I have used it many times and did not see anything wrong. Never wonder what is the real different between them before I tried the wp_die() yesterday.
This is how it is different on the look:
The die() returns a simply blank page.
The wp_die() function in WordPress has a nice box with shadow
So, rather than design of output, what are the differences between these?
- die() = exit = Output a message and terminate the current script.
- wp_die() – Kills WordPress execution and displays HTML page with an error message.
When to use wp_die() and die()
- die() output is ugly. Not good for user experience. If you want to display the error to front-end users in a better way, should use wp_die() instead.
- If you want to pass arguments to control behavior, use wp_die(). It has more options than die().
- Use of wp_die() will allow other plugins / functions to hook into the event sequence.