Tag Info

Hot answers tagged

4

You should be using the wpdb class for all your own queries. All core queries also use wpdb. See wpdb Show and Hide SQL Errors <?php $wpdb->show_errors(); ?> <?php $wpdb->hide_errors(); ?> You can also print the error (if any) generated by the most recent query with print_error. <?php $wpdb->print_error(); ?> Also see ...


3

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 ...


2

This works fine for me as db-error.php in wp-content: Delete the mailer block if you don't want it <?php header('HTTP/1.1 503 Service Temporarily Unavailable'); ?> <?php $to = "me@mysite.com"; $subject = "My Database is down"; $message = "My Database is down"; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; ...


2

Fatal errors point to bad syntax, or bad naming conventions. WordPress does a good job of not activating plugins that throw fatal errors. However, once a plugin is activated, all bets are off. If you've created a function or a class, it's best to follow good naming conventions and namespace properly. For example, a function called post_extras() would not be ...


2

This is actual mail server trouble, where email cannot be sent. This link will useful. http://angstrey.com/index.php/2009/04/22/how-to-send-e-mail-with-wordpress-from-godaddy-windows-hosting/


2

If you will write inside the console of your browser, then use one of a lot of helpers or use a small custom function in php. The follow function is easy to use and log inside the console of the browser. if ( ! function_exists( 'debug_to_console' ) ) { /** * Simple helper to debug to the console * * @param object, array, string $data ...


1

I wouldn't use that hook. Here's why Try something like this using admin_notices. function wpsites_admin_notice() { $screen = get_current_screen(); if( 'post' == $screen->post_type && 'edit' == $screen->base ){ ?> <div class="error"> <p><?php _e( 'Updated Demo Message!', 'wpsites' ); ?></p> </div> ...


1

You've already got a check for $_POST == empty. **if (!empty($_POST)){ $pfs = pfs_submit($_POST,$_FILES); echo json_encode($pfs); //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($pfs, true)."\n"; wp_redirect("http://domda.se/tack/"); exit; } else { /* TODO: translate following */ _e('Den här sidan hade du inte behövt se, något ...


1

This is how I've handled passing messages back to the user before: within your current function, set a transient with your message: set_transient( 'admin_notice', 'Please put down your weapon. You have 20 seconds to comply.' ); Then add a new hooked function: function admin_notices() { $notice = get_transient( 'admin_notice' ); if ( $notice ) { ...


1

Just did a quick search to see if JavaScript has a global error handling function which you could use and found window.onerror. So I haven't looked any further into it to see if it's well supported, but presumably you could use the window.onerror function to send an ajax request to php which could send page,browser, probably failed script info etc. then use ...



Only top voted, non community-wiki answers of a minimum length are eligible