It’s best to just log errors to the server and then use bash or a server script that supports email and error analysis (instead of PHP). There are lots of log file tools out there, simple ones like Logwatch, Swatch, Octopussy, or more complex ones like Nagios.
For errors which are triggered using WP_Error
you can write an email alert or log function right into the class, that is if it’s your code.
I recommend checking this out: https://github.com/pippinsplugins/WP-Logging
Additionally WP supports a maintenance.php
and a db-error.php
file that you can customize, the last one being more beneficial to your question since it will handle WP related DB errors.
You can of course use PHP to mail errors for example using the above: http://yoast.com/custom-wordpress-database-error-pages/
But your really better off using log files and a log analyzer to do this type of work on a production server.
Related Posts:
- How to use live images on local install?
- Declaratively Configuring WordPress in XML or JSON or YAML
- Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes)
- Set wp-content folder to Dropbox folder
- How can I make wordpress suppress mysql errors?
- Error establishing a database connection on Installation
- Why edits to wp-config.php must come before “That’s all” comment
- Publishing WordPress from stage to production server
- What should index.php contain on Synology NAS to get external access to WordPress to work?
- WP_SITEURL vs WP_HOME link output
- Change URL when visiting wordpress site
- Best practice for versioning wp-config.php?
- Control verbosity level of WP DEBUG?
- Password in wp-config. Dangerous?
- What’s the difference between WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT?
- Turn Off Automatic Trash Deletion?
- Notice: Constant WP_POST_REVISIONS already defined
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- How can I change preview URL?
- Override the wp_siteurl and wp_home not work
- Changing WP_CONTENT_DIR and WP_CONTENT_URL in wp-config.php does not register?
- Missing a temporary folder despite settings in wp-config.php
- Generate WordPress salt
- Syntax of FS_CHMOD_DIR and FS_CHMOD_FILE
- How to combine javascript files without plugins?
- WP_MEMORY_LIMIT didn’t work in wp-config
- Override Current Theme Setting in wp_config.php
- Call to undefined function error after adding add_filter to wp-config
- How to set up gmail SMTP in WordPress
- Too many datadabse connections – upper ceiling mysql
- error:-Cannot modify header information – headers already sent by
- How do I set up Debugging?
- Changing HTTP URL Port
- Notice: Constant already defined in wp-config.php on (non-existent) line?
- wp-config.php file permissions
- How to update WordPress from the latest trunk
- how to use is_admin in wp-config.php
- Locked out of WordPress Site Admin after enabling Force SSL on WordPress Https (SSL)
- How to change how long items are kept in the trash?
- Including a 3rd party library in WordPress which needs to be accessible by wp-config
- What should be disabled to run on an internal network with no access to the Internet?
- wp-config.php being deleted
- Get WP CLI to hide debug warnings and notices in JSON output, same setting as website
- Installation Issue WordPress locally – The file ‘wp-config.php’ already exists
- What is this file: wp-config-wpe.php?
- Can I configure WordPress to use postfix without a plugin?
- enable SFTP via SSH keys in wordpress
- html lang=”” instead of lang=”en-us” – why?
- Why do I get a WAMP homepage when clicking on specific website’s URL on LocalHost?
- Creating the wp-config.php file manually
- What Does this Code Snippet Do?
- WP_Debug not displaying anything
- Can I delete `wp-config-sample.php` after installing and configuring WordPress?
- How to reliably set file/folder permissions?
- “There doesn’t seem to be a wp-config.php file.” despite wp-config.php in root
- Moving WP from local server to live, error establishing a db connection
- Multiple wp-config.php files in one home directory
- error log cluttered with undefined DB_USER wp-admin/setup-config.php
- wp-config dynamic hostname in WP_HOME and WP_SITEURL
- Is it possible to override the ABSPATH constant
- How to stop fatal error when loading theme template file directly
- WordPress – Promoting A Dev Build In A Subdirectory To Production / Root Directory
- Should I change wp-config for SSL?
- Out of memory errors : how best to track them down
- DOMAIN_CURRENT_SITE constant being regularly overridden [closed]
- Redefine cookie domain for subdomains
- HTTP Error after finishing uploading a video that is bigger than 64 MB -> After raising the upload limit manually in the wp-config file
- multiple language directories
- Error in database connection [closed]
- Update wp-config.php and lost pages
- Conflict with wp_homeurl, wp_siteurl and admin interface settings
- error messages in dashboard login
- where should I write constants in wordpress?
- Issues copying site into local machine
- Autosave interval remains default despite wp-config.php defines
- Carriage Return control character (^M) found in wp-config-sample.php
- Are the wordpress settings (abspath, disable core updates) added by SiteGround of any use after I’ve migrated to a different host?
- Need help fixing my wp-config file [closed]
- Why was my new WordPress installation’s config page publicly viewable when first installed?
- WP_MEMORY_LIMIT didn’t work in wp-config, only within default-constants.php
- Cookie set without HttpOnly flag
- Changing the wp-config.php broke the site
- Define option outside wp-config.php (on WordPress.com)
- Site lost all formatting when I attempted to migrate to Bluehost [closed]
- Moving wp-config.php one level up – 500 error – Nginx [closed]
- How can I configure an SMTP Server?
- Remote server does not read `WP_HOME` from wp-config.php when local server does
- Cannot access WordPress website from external IP while internally it is working properly [closed]
- IP addresses to block to stop WP auto-update?
- Why when I try to access to this old WordPress site it is opened the installation page?
- Concerns over wp-config file [closed]
- Not showing old migrated content in website
- How to rename the wp-config.php file once under version control?
- Read wp-config without loading the rest of WordPress – i.e. wp-settings, etc
- Proper way to have multiple installs with a single database
- How turn on error reporting without reset?
- WordPress installed on a Sub-directory
- Editing wp-config.php file asks for another installation
- $post->id vs $post->ID problem after using WordPress config bootstrap
- Getting WordPress to work inside a rails 3 application