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?
- What’s the difference between WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT?
- Turn Off Automatic Trash Deletion?
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- How can I change preview URL?
- Missing a temporary folder despite settings in wp-config.php
- Syntax of FS_CHMOD_DIR and FS_CHMOD_FILE
- How to combine javascript files without plugins?
- Call to undefined function error after adding add_filter to wp-config
- How to set up gmail SMTP in WordPress
- error:-Cannot modify header information – headers already sent by
- Notice: Constant already defined in wp-config.php on (non-existent) line?
- 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
- 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
- Why do I get a WAMP homepage when clicking on specific website’s URL on LocalHost?
- Creating the wp-config.php file manually
- 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
- 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
- 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]
- 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
- 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
- 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]
- 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]
- Why when I try to access to this old WordPress site it is opened the installation page?
- Concerns over wp-config file [closed]
- 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
- $post->id vs $post->ID problem after using WordPress config bootstrap
- How to stage a redesigned site on a new webhost while the original site is still live? [closed]
- Changes not being reflected on new server
- Need help re-connecting local WP-config file to local database
- wp-config.php randomly will reset to wp-config-sample.php
- How to fix wp-login.php gives error 500 after migration?
- Define new constants in wp-config
- sudden changing of host IP result in crash of the site
- Move wp-content outside root
- Can you define readability settings in wp-config.php?
- Unable to change WordPress language (WordPress 4.2.2)
- Why is WordPress not using $_SERVER[‘SERVER_NAME’] for ‘WP_SITEURL’ and ‘WP_HOME’ as default?
- WordPress Redirect on Name Change
- Getting error when trying to redirect WP site to mobile site
- Is there any reason why using the same wp-config file might not work in MAMP?
- Best function/method to access wp-config?
- WordPress still requires FTP information
- WordPress doesn’t recognise my email address and I’m missing the wp-config file in PHPmyadmin cPanel to make alterations
- WordPress White Screen Error
- Why would changing ports from 80 to 8080 cause wordpress to act unexpectedly?
- Other pages fine but wp-admin showing ERR_TOO_MANY_REDIRECTS Error
- Better error messages upon critical errors – HTTP Error 500
- Fatal error trace not shown in development setup
- max_input_vars not updating through wp-config
- Disabling zlib compression and enforcing gzip
- Can WP-CLI modify database connection details in existing wp-config file?
- How to specify server path in code?